Verwenden Sie die Eigenschaft flex order, um Elemente für Desktop- und mobile Ansichten neu anzuordnen.
Ich habe 3 divs in einem Container. Es gibt keine verschachtelten Divs.
Ich benutze flex undorder
Eigentum
uf dem Handy ist es in Ordnung mitorder
Eigentum
Aber auf größeren Bildschirmen schlägt es fehl.
Ich habe für die Divs 2 und 3 kein Container-Div verwendet, um sie auf dem Handy als 2,1,3 zu bestellen.
HTML FILE
<div class="container">
<div class="orange">1</div>
<div class="blue">2</div>
<div class="green">3</div>
</div>
CSS FILE
/*************** MOBILE *************/
.container
{
display: flex;
flex-wrap: wrap;
}
div.blue
{
order:1;
width: 100%;
}
div.orange
{
order:2;
width: 100%;
}
div.green
{
order:3;
width: 100%;
}
/***************************/
@media screen and (min-width:1200px)
{
.container
{
justify-content: space-between;
}
div.blue
{
order:2;
width: 36%;
}
div.orange
{
order:1;
width: 60%;
}
div.green
{
order:3;
width: 36%;
}
}