当设备宽度低于 900 像素时,我正在尝试重新排列 3 个 div。它们被排列为三列(2 个 float div 和中间的主列),我不知道如何使它们成为 2 列和它们下面的第三个 div(Image 显示了我的目标)。 提前谢谢你:)
按照您的要求添加代码 :) 这是 html
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="container">
<header></header>
<div id="left"></div>
<div id="right"></div>
<div id="middle"></div>
</div>
</body>
</html>
这是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;
}
如果我让右边的 div float:none 然后它移动中间的 div
最佳答案
关于html - 将 3 个 div 列的布局更改为 2 个 div 列和下面的第 3 个,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41474736/