V
V
Vladimir2017-07-04 16:07:52
css
Vladimir, 2017-07-04 16:07:52

How to push a flex container to the right side?

Good day! Here is such a menu:
ee5a00e9ff1b4f399616525bbfede7bb.png
All menu items are li in ul, that is, a list. Here is the CSS:

.header-menu
  width: 100%
  display: flex
  margin: 0
  & > li
    display: flex
    justify-content: center
    flex-direction: column
    margin-right: 15px
    margin-left: 15px
    position: relative

Each li is also a flex container (if I understand correctly). I need to do for the last two so to speak float: right. But I can't figure out how to do it. ul is stretched to its full width, that is, there is enough space to move them. I tried different justify and align but something doesn't work :(
Tell me how to implement it correctly. Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Bulba, 2017-07-04
@MasterGerold

Banal margin-left: auto works wonders. Hello tricky points from the spec :)
Here is your solution:
https://jsfiddle.net/a0hz7hp1/3/

A
Anton fon Faust, 2017-07-04
@bubandos

First, it's not css, it's scss.
Secondly, take the already compiled css and see what styles you have applied to what.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question