Forum Moderators: not2easy
Left Column
<div style="float: right">
<span style="margin-right: 20px">Right Column 1</span>
Right Column 2
</div> <div style="display: flex">
<div style="flex-basis: 100%">Left Column</div>
<div style="margin-right: 20px; white-space: nowrap">Right Column 1</div>
<div style="white-space: nowrap">Right Column 2</div>
</div> “Left justified” or “right justified” sounds like a contradiction in terms.
Can we assume that the examples with inline styles are just for posting purposes, and you're not really going to do that? ;)
[edited by: lucy24 at 5:28 pm (utc) on Jan 8, 2024]
The question I'd be asking is how you want that 100% to be apportioned if (a) one or more elements, if left to their own resources, could by themselves take up the whole width, or (b) the content of all three elements combined would not use up the whole width. Here it kinda looks as if you want the two last elements to have some minimal width, and then everything else goes to the first element.
I seem to recall That Browser still visits the site in question - but this might be for something else.
<div class="flex gap-20px whitespace-nowrap">
<div class="flex-auto">
Left Column
</div>
<span class="flex-initial text-right">
Right Column 1
</span>
<span class="flex-initial text-right">
Right Column 2
</span>
</div>
.flex {
display: flex;
}
.flex-auto {
flex: 1 1 auto;
}
.flex-initial {
flex: 0 1 auto;
}
.gap-20px {
gap: 20px;
}
.text-right {
text-align: right;
}
.whitespace-nowrap {
white-space: nowrap;
}
flex: 1 1 auto;
flex-grow: 1;
flex-shrink: 1;
flex-basis: auto;
flex: 0 1 auto;
flex-grow: 0;
flex-shrink: 1;
flex-basis: auto;