Reputation: 491
I have 3 elements, and I want the third one to display before the previous 2. The third is also an image, and the height vary from each content.
The structure I have is:
<div class="first">
..
</div>
<ul>
<li>..</li>
</ul>
<div class="image">
</div>
How can I display the image before the first div with css? If not possible with this config, I can also create a new div for the ul, but only if not possible.
Upvotes: 1
Views: 559
Reputation: 382092
A solution would be to use the order
flex property:
body {
display: flex;
flex-direction: column;
}
.image {
order:-3;
}
<div class="first">
first
</div>
<ul>
<li>li</li>
</ul>
<div class="image">image
</div>
Annex: FlexBox compatibility
Upvotes: 2