09Bootstrap5按钮组
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="../css/bootstrap.min.css">
<title>菜鸟教程Bootstrap5按钮组</title>
<script src="../js/bootstrap.bundle.min.js"></script>
</head>
<body>
<div class="container mt-3">
<h2>按钮组</h2>
<p> .btn-group 类用于创建按钮组:</p>
<div class="btn-group">
<button type="button" class="btn btn-primary">苹果</button>
<button type="button" class="btn btn-primary">三星</button>
<button type="button" class="btn btn-primary">华为</button>
</div>
</div>
<div class="container mt-3">
<h2>按钮组大小</h2>
<p>我们可以使用 .btn-group-lg|sm|xs 类来设置按钮组的大小。</p>
<h3>大按钮:</h3>
<div class="btn-group btn-group-lg">
<button type="button" class="btn btn-primary">苹果</button>
<button type="button" class="btn btn-primary">三星</button>
<button type="button" class="btn btn-primary">华为</button>
</div>
<h3>默认按钮:</h3>
<div class="btn-group">
<button type="button" class="btn btn-primary">苹果</button>
<button type="button" class="btn btn-primary">三星</button>
<button type="button" class="btn btn-primary">华为</button>
</div>
<h3>小按钮:</h3>
<div class="btn-group btn-group-sm">
<button type="button" class="btn btn-primary">苹果</button>
<button type="button" class="btn btn-primary">三星</button>
<button type="button" class="btn btn-primary">华为</button>
</div>
</div>
<div class="container mt-3">
<h2>垂直按钮组</h2>
<p>可以使用 .btn-group-vertical 类来创建垂直的按钮组:</p>
<div class="btn-group-vertical">
<button type="button" class="btn btn-primary">苹果</button>
<button type="button" class="btn btn-primary">三星</button>
<button type="button" class="btn btn-primary">华为</button>
</div>
</div>
<div class="container mt-3">
<h2>内嵌按钮组</h2>
<p>按钮组设置下拉菜单:</p>
<div class="btn-group">
<button type="button" class="btn btn-primary">苹果</button>
<button type="button" class="btn btn-primary">三星</button>
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown">华为</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">荣耀</a></li>
<li><a class="dropdown-item" href="#">麒麟</a></li>
</ul>
</div>
</div>
</div>
<div class="container mt-3">
<h2>垂直按钮组及下拉菜单</h2>
<div class="btn-group-vertical">
<button type="button" class="btn btn-primary">苹果</button>
<button type="button" class="btn btn-primary">三星</button>
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown">华为</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">荣耀</a></li>
<li><a class="dropdown-item" href="#">麒麟</a></li>
</ul>
</div>
</div>
</div>
<div class="container mt-3">
<h2>多个按钮组并排</h2>
<div class="btn-group">
<button type="button" class="btn btn-primary">苹果</button>
<button type="button" class="btn btn-primary">三星</button>
<button type="button" class="btn btn-primary">华为</button>
</div>
<div class="btn-group">
<button type="button" class="btn btn-danger">苹果</button>
<button type="button" class="btn btn-danger">三星</button>
<button type="button" class="btn btn-danger">华为</button>
</div>
</div>
</body>
</html>