twitter-bootstrap - Bootstrap 4 超小列宽度 100% 不工作

标签 twitter-bootstrap bootstrap-4 bootstrap-grid

我用 Bootstrap 4 开发了一个静态 HTML 页面,使用与大屏幕相同的 col 但在 Extra small 屏幕上,col 没有得到 100% 宽度。我忘记了什么?

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" />
<div class="container">
     <div class="form-row">
        <!-- Grid column -->
        <div class="col col-6">
            <!-- Material input -->
            <div class="md-form">
                <input type="text" class="form-control" placeholder="City">
            </div>
        </div>
        <!-- Grid column -->

        <!-- Grid column -->
        <div class="col">
            <!-- Material input -->
            <div class="md-form">
                <input type="text" class="form-control" placeholder="State">
            </div>
        </div>
        <!-- Grid column -->

        <!-- Grid column -->
        <div class="col">
            <!-- Material input -->
            <div class="md-form">
                <input type="text" class="form-control" placeholder="Zip">
            </div>
        </div>
        <!-- Grid column -->
    </div>
    </div>

最佳答案

Extra small col width 100% not working

列不是 100% 宽度,因为 colauto-layout column对于最小的 xs 屏幕尺寸,因此列的宽度将继续缩小,并且永远不会垂直堆叠。

只需使用 col-sm 代替...

https://www.codeply.com/go/xb7WffaSmS

<div class="container">
    <div class="form-row">
        <!-- Grid column -->
        <div class="col-sm-6">
            <!-- Material input -->
            <div class="md-form">
                <input type="text" class="form-control" placeholder="City">
            </div>
        </div>
        <!-- Grid column -->

        <!-- Grid column -->
        <div class="col-sm">
            <!-- Material input -->
            <div class="md-form">
                <input type="text" class="form-control" placeholder="State">
            </div>
        </div>
        <!-- Grid column -->

        <!-- Grid column -->
        <div class="col-sm">
            <!-- Material input -->
            <div class="md-form">
                <input type="text" class="form-control" placeholder="Zip">
            </div>
        </div>
        <!-- Grid column -->
    </div>
</div>

另请注意,-xs 中缀已在 Bootstrap 4 中删除。现在最小的类是简单的 colcol -6, col-12, 等等...

关于twitter-bootstrap - Bootstrap 4 超小列宽度 100% 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49795805/

相关文章:

javascript - Bootstrap 4 侧边栏多级 - 折叠显示隐藏不起作用

php - 为什么 Bootstrap 网格定位会留下空列?

jquery - 使水井漂浮在 body 上而不是将元素插入 body

twitter-bootstrap - 带有调整大小栏的自定义 Summernote 工具栏

html - 为什么 row-fluid :before and row-fluid:after have a height?

css - 如何删除 bootstrap 4 中的选择选项背景?

css - 当我使用少于 12 列时,如何避免将 Bootstrap 列分解为行?

twitter-bootstrap - Bootstrap 4 - 中心按钮

javascript - 无法创建所需的 UI

html - 在 bootstrap 中对列重新排序以获得更大的显示