Simply put, is there a way to justify the content of a flexbox but exclude the first item from this? The easiest way is to take the item out of the flexbox, but I’m just wondering if it’s possible to skip over the first item before the justify-content
takes effect.
<div class="flex">
<div class="exclude">exclude</div>
<div class="item">item</div>
<div class="item">item</div>
<div class="item">item</div>
<div class="item">item</div>
</div>
Theoretically it should look like:
(1) (2) (3) (4) (5)
exclude item item item item
Where the space between (1)
and (2)
is native and not being done by the flex (assume it’s 1px
between the two words) but the rest of the item
s are spaced due to justify-content: between;
for example.
3
Answers
You can try using a wrapper too:
Use the property
justify-self
on.exclude
If you would like to keep the actual
html
content as it is, I would do as follows:It is similar to the solution above, but in this case I kept the content as it is.