html - Bootstrap 3 响应容器宽度而不是屏幕宽度

标签 html css twitter-bootstrap

我正在使用 Bootstrap 3 并且习惯于使用屏幕宽度,现在当它低于某个屏幕宽度时,行变为水平而不是分布在列上。

但是,我希望我的容器为屏幕宽度,因此如果容器宽度为 <768px,则线条变为水平。

我试过使用 .container-fluid 但它对我不起作用。我该如何解决这个问题?

<div style="width:200px;">
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-6">Test</div>
            <div class="col-sm-6">Test</div>
        </div>
    </div>
</div>

最佳答案

如果您不希望您的列折叠,请使用 col-xs 而不是 col-sm。

像这样:

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>

<div style="width:200px;">
    <div class="container-fluid">
        <div class="row">
            <div class="col-xs-6" style="background:red">Test</div>
            <div class="col-xs-6" style="background:yellow">Test</div>
        </div>
    </div>
</div>

关于html - Bootstrap 3 响应容器宽度而不是屏幕宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27551661/

相关文章:

css - 将 div 堆叠成 2 行,没有空格

html - Bootstrap 中的响应式交错行

html - IE 怪癖模式使页面呈现奇怪 - LI 元素不是水平的

javascript - 引用错误 : angular is not defined in app. js 第 1 行

html - 如何在 less 中使用嵌套规则?

javascript - Bootstrap 导航栏切换不渲染

css - 响应式图片库 bootstrap 3

HTML CSS 打印页面去除顶部和底部的空白

javascript - 使用 display flex 让只有一个 child 占据 parent 100% 的高度?

javascript - 网页优化: Should CSS and JS be inserted into the HTML resource after minification?