【发布时间】:2016-10-19 16:15:02
【问题描述】:
我只想知道如何使用 CSS 重新排列移动设备的 div 元素。请检查下面的图片以提及我到底需要什么。
桌面如下所示
但在移动视图中,我需要像下面这样互换位置。
我检查了它,但我没有得到任何解决方案,你能在这种情况下帮助我吗? 我使用的是 Bootstrap v3.3.7
<div class="container">
<div class="row">
<div class="col-sm-4 col-lg-4 col-sm-push-8">
<div class="border">
Content B
<hr/>
<p>
I think most people would (at first) assume that the desktop views would be rendered in normal order and that the pushing and pulling are done on the mobile views. Once you realize that the complete opposite is true, you begin to understand how to layout your columns in the correct order, and the correct classes that need to be used.
Conclusion
The two statements below summarize the functionality of the push and pull classes and should give you the full understanding of how they work, and how they should be used.
col-vp-push-x = push the column to the right by x number of columns, starting from where the column would normally render (position: relative), on a vp or larger view-port.
col-vp-pull-x = pull the column to the left by x number of columns, starting from where the column would normally render (position: relative), on a vp or larger view-port.
vp = xs, sm, md, or lg (minimum viewport)
x = 1 thru 12 (number of columns)
</p>
</div>
</div>
<div class="col-sm-8 col-lg-8 col-sm-pull-4">
<div class="border">
Content A
<hr/>
<p>
I think most people would (at first) assume that the desktop views would be rendered in normal order and that the pushing and pulling are done on the mobile views. Once you realize that the complete opposite is true, you begin to understand how to layout your columns in the correct order, and the correct classes that need to be used.
</p>
</div>
</div>
</div>
</div>
https://jsfiddle.net/ravinthranath/b2Lfcqua/ 和 https://jsfiddle.net/ravinthranath/4tw2p4j9/
【问题讨论】:
-
希望您至少尝试自己编写代码。 Stack Overflow 不是代码编写服务。我建议你做一些additional research,通过谷歌或搜索SO,尝试一下。如果您仍然遇到问题,请返回您的代码并解释您尝试过的操作。
-
你是对的@paulie_d,我尝试了 js fiddle 中的情况,我忘了在这里添加它,我为此道歉,而且我知道这不是代码编写服务。请查看我的个人资料,以便您了解我。
标签: jquery html css responsive-design