I'm trying to create a layout where most of my items align to the left of the viewport, but one item needs to align to the right.
I would rather not use float: right;
in this instance and would prefer to make use of justify-content: flex-end;
I have made a codepen which visually shows the correct layout, but it has an extra div (I've titled it .remove-this-div
) that I'd rather not have there, as I want to keep my mark-up as clean as possible and avoid wrapper divs where they are not required
The mark-up I'm after whilst still getting the button to align right
is like this:
<section>
<div>I sit to the left</div>
<div>I sit to the left</div>
<div>I sit to the left</div>
<div>I sit to the left</div>
<button>I sit to the right</button>
</section>