<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap 示例</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://www.w3schools.cn/lib/bootstrap/5.1.3/css/bootstrap.min.css" rel="stylesheet">
<script src="https://www.w3schools.cn/lib/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script>
</head>
<body>
<div class="container-fluid mt-3">
<h1>自动布局列</h1>
<p>在 Bootstrap 5 中,有一种创建等宽列的简单方法:只需在指定数量的 col 元素上使用 <code>.col-size</code> 类。 Bootstrap 将识别有多少列,并且每列将获得相同的宽度。</p>
<p>两列:在所有屏幕上为 50% 宽度,超小屏幕除外(在宽度小于 <strong>576px</strong> 的屏幕上为 100% 宽度)</p>
<div class="container-fluid">
<div class="row">
<div class="col-sm bg-primary text-white p-3">1 of 2</div>
<div class="col-sm bg-dark text-white p-3">2 of 2</div>
</div>
</div>
<br>
<p>四列:所有屏幕上的 25% 宽度,超小屏幕除外(宽度小于 <strong>576px</strong> 的屏幕上为 100% 宽度)</p>
<div class="container-fluid">
<div class="row">
<div class="col-sm bg-primary text-white p-3">1 of 4</div>
<div class="col-sm bg-dark text-white p-3">2 of 4</div>
<div class="col-sm bg-primary text-white p-3">3 of 4</div>
<div class="col-sm bg-dark text-white p-3">4 of 4</div>
</div>
</div>
</div>
</body>
</html>