While it's common knowledge how to align one item to the right in flexbox, what about aligning multiple items, like the last two elements, to the right and the rest to the left? Take a look at this example where I want elements with the class .r
to be aligned to the right of the header menu.
ul {
display: flex;
justify-content: flex-start;
flex-direction: row;
align-items: center;
/* width: 100%; */
height: 100px;
background: #333;
padding: 15px;
}
ul li {
padding: 15px;
margin: 5px;
background: #efefef;
border: 1px solid #ccc;
display: inline-block;
list-style: none;
}
.r {
margin-left: auto;
}
<ul>
<li>Home</li>
<li>Menu</li>
<li>More</li>
<li>Stuff</li>
<li class="r">Login</li>
<li class="r">Sign Up</li>
</ul>
If you could offer any assistance, it would be greatly appreciated.