To ensure proper alignment, wrap all content within a new <div>
and assign it a class of main-container
.
Next, set the display property of the main container to flex:
display: flex;
In order to add another <div>
to the left of elements within the <div>
with class container
, change the flex-direction to row-reverse:
flex-direction: row-reverse;
The entire main container will align to the right. Since it is in reverse, the justify-content should be set to flex-end:
justify-content: flex-end;
The another_div
appears at the bottom instead of the top, indicating that items are vertically aligned to the bottom. To achieve this, align-items should be set to flex-end:
align-items: flex-end;
.main-container {
display: flex;
flex-direction: row-reverse;
justify-content: flex-end;
align-items: flex-end;
}
Check out the code on Codepen: https://codepen.io/geekyquentin/pen/wvyJOBX