【发布时间】:2015-08-09 11:59:12
【问题描述】:
我正在重新设计一个包含 3 个divs 的页面,我想让它具有响应性。
我面临的问题是大屏幕的divs 是按照1,2,3的顺序排列的。但是,对于响应式设计,我想将顺序更改为 1,3,2:
我尝试了不同的方法,例如将 position 更改为 relative/absolute/static 或使用替代 CSS 代码更改 divs 顺序,但到目前为止没有任何效果。
有什么想法可以实现吗?
.one {
float: left;
width: 150px;
border: solid 2px #eaeaea;
position: relative;
z-index: 0;
margin-bottom: 20px;
height: 100px;
}
.two {
float: left;
margin: 0 0 0 24px;
width: 150px;
border: solid 2px #eaeaea;
height: 100px;
}
.three {
float: left;
width: 900px;
border: solid 2px #eaeaea;
height: 100px;
}
@media only screen and (max-width: 500px) {
.one {
width: 93%;
padding: 3%;
}
.two {
width: 100%;
margin-left: 0px;
}
.three {
width: 100%;
margin: 0px;
}
}
<div class="one">Content1</div>
<div class="two">Content2</div>
<div class="three">Content3</div>
<div class="500markup">This box is 500px</div>
【问题讨论】:
-
如果你使用jquery,你可以试试
.insertbefore() -
你在使用引导程序吗?
-
Bootstrap 是你最好的朋友。
-
@ketan,这正是我所需要的!您可以将其粘贴为答案,以便我接受!
标签: html css responsive-design position css-position