Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

Bootstrap 5 网格 XXL


XXL 网格示例

  XSmall Small Medium Large Extra Large 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 会识别有多少列,并且每列都会获得相同的宽度。

如果屏幕尺寸小于 1400px,列将水平堆叠。

<!-- 两列: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
动手试试 »

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.