There is a parent div .main contains two child div .child. I have set the parent div as flex-wrap: wrap;, but the child div is wrapped in the first place when the screen width is wide enough.
.main {
background-color: gray;
display: flex;
flex-wrap: wrap;
gap: 10px;
padding: 10px;
}
.child {
background-color: green;
height: 50px;
}
.child:first-child {
flex: 1 0 70%;
}
.child:last-child {
flex: 1 0 30%;
}
<div class="main">
<div class="child"></div>
<div class="child"></div>
</div>
They should look like this at first
.main {
background-color: gray;
display: flex;
gap: 10px;
padding: 10px;
}
.child {
background-color: green;
height: 50px;
}
.child:first-child {
width: 70%
}
.child:last-child {
width: 30%
}
<div class="main">
<div class="child"></div>
<div class="child"></div>
</div>
And they should wrap when the screen width is so small
.main {
background-color: gray;
display: flex;
flex-direction: column;
gap: 10px;
padding: 10px;
}
.child {
background-color: green;
height: 50px;
width: 100%;
}
<div class="main">
<div class="child"></div>
<div class="child"></div>
</div>