作者:俞承豪那个男人- | 来源:互联网 | 2023-05-18 05:56
Imtryingtorearrange3divswhendevicewidthisbelow900px.Theyarearrangedasthreecolumns
I'm trying to rearrange 3 divs when device width is below 900px. They are arranged as three columns (2 floating divs and main one in the middle) and i don't know how to make them be 2 columns and third div below them (Image shows what i'm aiming at). Thank you in advance :)
当设备宽度低于900px时,我正在尝试重新排列3个div。它们被安排为三列(2个浮动div和主要的一个在中间),我不知道如何使它们成为2列和它们下面的第三个div(图像显示了我的目标)。先谢谢你 :)
Adding code as you asked :) here is html
你问的问题添加代码:)这里是html
and here is css
这是css
#container{
width: 90%;
margin: 0px auto 0px auto ;
}
header{
width: 100%;
height: 200px;
background-color: blue;
}
#left{
float: left;
width: 20%;
height: 500px;
background-color: orange;
}
#right{
float: right;
width: 20%;
height: 500px;
background-color: green;
}
#middle{
width: 80%;
background-color: red;
height: 500px;
}
if i make right div float:none then it moves the middle div
如果我做正确的div浮动:无,那么它移动中间div
5 个解决方案