Bootstrap 5 网格 XXL
XXL 网格示例
超小号 | 小 | 中 | 大 | 特大尺寸 | XXL | |
---|---|---|---|---|---|---|
类前缀 | .col- |
.col-sm- |
.col-md- |
.col-lg- |
.col-xl- |
.col-xxl- |
屏幕宽度 | <576px | >=576px | >=768px | >=992px | >=1200px | >=1400px |
XXL 设备被定义为屏幕宽度从 1400 像素及以上。
以下示例将在中型、大型和超大型设备上产生 50%/50% 的分割,在 XXL 设备上产生 25%/75% 的分割。在小型和超小型设备上,它将自动堆叠(100%)
col-md-6 col-xxl-3
col-md-6 col-xxl-9
示例
<div class="container-fluid">
<div class="row">
<div class="col-md-6 col-xxl-3">
<p>Lorem ipsum...</p>
</div>
<div class="col-md-6 col-xxl-9">
<p>Sed ut perspiciatis...</p>
</div>
</div>
</div>
自己动手试一试 »
注意:确保总和始终为 12。
仅使用 XXL
在下面的示例中,我们只指定了 .col-xxl-6
类(没有 .col-md-*
和/或 .col-sm-*
)。这意味着超大型设备将按 50%/50% 分割。但是,对于超大、大、中、小和超小型设备,它将垂直堆叠(100% 宽度)
示例
<div class="container-fluid">
<div class="row">
<div class="col-xxl-6">
<p>Lorem ipsum...</p>
</div>
<div class="col-xxl-6">
<p>Sed ut perspiciatis...</p>
</div>
</div>
</div>
自己动手试一试 »
自动布局列
在 Bootstrap 5 中,有一种简单的方法可以为所有设备创建等宽列:只需从 .col-xxl-*
中删除数字,并仅在指定数量的 col 元素上使用 .col-xxl
类。Bootstrap 将识别有多少列,并且每列将获得相同的宽度。
如果屏幕尺寸 小于 1400 像素,则列将水平堆叠。
<!-- 两列:在 XXL 及以上设备上宽度为 50% -->
<div class="row">
<div class="col-xxl">1 of 2</div>
<div class="col-xxl">2 of 2</div>
</div>
<!-- 四列:在 XXL 及以上设备上宽度为 25% -->
<div class="row">
<div class="col-xxl">1 of 4</div>
<div class="col-xxl">2 of 4</div>
<div class="col-xxl">3 of 4</div>
<div class="col-xxl">4 of 4</div>
</div>
1 of 2
2 of 2
1 of 4
2 of 4
3 of 4
4 of 4