【发布时间】:2014-01-07 07:42:01
【问题描述】:
我已经为此工作了好几个小时,并尝试了无数次 Google 搜索,但还没有找到可靠的解决方案。我正在使用 BootStrap 3 和 SASS 开发网站响应式布局(宽度 940px)。我一直在关注 BootStrap 3 在线文档,这非常有帮助。一切在桌面上运行良好,但是我很好奇,想知道是否可以使用媒体查询来操作移动布局。目前,我在容器中有两行,每行内有四列水平(请看图片)
当我在 iPhone 5 上的“纵向”视图中查看此布局时,我看到所有列都垂直堆叠,因为它们应该是好的。 (请看图)
问题
当我在 iPhone 5 上的“横向”中查看此布局时,所有两行的列都保留为“纵向视图”,但在屏幕上延伸,我希望看到“纵向视图”显示两列一起,而不是只在屏幕上伸展的一个。 (请看图)
我尝试了多种方法并遵循了 BootStrap 3 在线文档,但无法在 iPhone 5(横向视图)上显示两列。是的,表格视图运行良好......没有问题。
如果有人能指出正确的方向,我将不胜感激。
我一直在关注这个 Bootstrap 3 在线资源: http://getbootstrap.com/css/#grid-example-mixed-complete
我在这段代码中只包含了一行。我有一个“splash-wrapper”,它扩展了三个类,然后是“splash-wrapper”中的“splash-box”
这是我的代码 CSS:
.splash-wrapper {
// XS
@extend .col-xs-6;
// SM
@extend .col-sm-4;
// MD
@extend .col-md-3;
}
.splash-box {
//DROP SHADOW
@extend .drop-shadow;
//BORDER RADIUS
@extend .border-radius;
background-color:#ffffff;
padding:.5em;
}
HTML 代码:
<!-- CONTAINER -->
<div class="container">
<!-- ROW -->
<div class="row"
<!-- SPLASH-WRAPPER -->
<div class="splash-wrap">
<!-- SPLASH BOX -->
<div class="splash-box">
<p>It is a long established fact that a reader will be distracted by the
readable content of a page when looking at its layout.It is a long established
fact that a reader will be distracted by the readable content of a page
when looking at its layout.</p>
</div><!-- //SPLASH BOX -->
</div><!-- //SPLASH-WRAP -->
<div class="splash-wrap">
<div class="splash-box">
<p>It is a long established fact that a reader will be distracted by the
readable content of a page when looking at its layout.It is a long established
fact that a reader will be distracted by the readable content of a page
when looking at its layout.</p>
</div>
</div><!-- //SPLASH-WRAP -->
<div class="splash-wrap">
<div class="splash-box">
<p>It is a long established fact that a reader will be distracted by the
readable content of a page when looking at its layout.It is a long established
fact that a reader will be distracted by the readable content of a page
when looking at its layout.</p>
</div>
</div><!-- //SPLASH-WRAP -->
<div class="splash-wrap">
<div class="splash-box">
<p>It is a long established fact that a reader will be distracted by the
readable content of a page when looking at its layout.It is a long established
fact that a reader will be distracted by the readable content of a page
when looking at its layout.</p>
</div>
</div><!-- //SPLASH-WRAP -->
<!-- //ROW -->
<!-- //CONTAINER -->
【问题讨论】:
-
github.com/twbs/bootstrap/issues/10203 - LESS,您必须转换为 SASS,然后将我在媒体查询中使用的 em 更改为像素。阅读@mdo cmets,因为响应式实用程序不支持纵向和横向之间的中间点,并且需要调整某些表单 css。
-
Cab,非常感谢,我偶然发现了那个讨论,在阅读了“mdo”回复后,我得出结论,“mdo”只是不接受存在需要解决的差距/问题得到解决。我正在考虑尝试 andyl 的解决方案/破解,看看是否能让事情变得更好。你试过andyl的要点吗?谢谢
-
我使用它完全没有任何问题。我喜欢它。
-
他已经接受了,但是 Bootstrap 的版本控制要求它在版本 4 而不是 3 中实现