【发布时间】:2017-08-23 13:53:28
【问题描述】:
编辑:我完全重写了这个问题,因为我认为我在原始帖子中不够清楚。
根据 bootstrap 的网站,浏览器每个类别列的宽度应该如下:
// Extra small devices (portrait phones, less than 576px)
// No media query since this is the default in Bootstrap
// Small devices (landscape phones, 576px and up)
@media (min-width: 576px) { ... }
// Medium devices (tablets, 768px and up)
@media (min-width: 768px) { ... }
// Large devices (desktops, 992px and up)
@media (min-width: 992px) { ... }
// Extra large devices (large desktops, 1200px and up)
@media (min-width: 1200px) { ... }
// Extra small devices (portrait phones, less than 576px)
@media (max-width: 575px) { ... }
// Small devices (landscape phones, less than 768px)
@media (max-width: 767px) { ... }
// Medium devices (tablets, less than 992px)
@media (max-width: 991px) { ... }
// Large devices (desktops, less than 1200px)
@media (max-width: 1199px) { ... }
// Extra large devices (large desktops)
// No media query since the extra-large breakpoint has no upper bound on its width
综上所述:col-xl为1200像素以上,lg在992-1199之间,md为768-991,sm为576-768,xs最大为575。
我的问题是,由于某种原因,我的网页表现得好像 xs 是 sm,sm 是 md,md 是 lg,lg 是 xl。
在 google chrome 检查器中查看此代码笔:https://codepen.io/colesam/full/YxjVwW/
lg及up中每行应该有3个项目,sm和md应该是每行2个,xs应该是1个。
请看下面的两个例子:
编辑 2:我的标题包含以下元标记:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
编辑 3:我现在尝试在两台不同的计算机上检查页面,但得到相同的结果。我还更新了 Bootstrap,但无济于事。我真的很困惑为什么会发生这种情况。我尝试在 html 中添加 xl 列,无论屏幕尺寸有多大,xl 列都不会激活。
这是 google chrome 检查器工具的图像。它表明 .col-md-* 已激活,即使我们在 lg 列的范围内:
【问题讨论】:
-
您忘记了视口元标记。
-
我的主项目上有这个标签: 但我不知道我需要一个一个密码笔。我现在将更新 codepen。
-
您使用的是哪个版本的 Bootstrap?
-
3.3.7 on the codepen
标签: html css twitter-bootstrap