08Bootstrap5按钮
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>菜鸟教程Bootstrap5按钮</title>
<link rel="stylesheet" href="../css/bootstrap.min.css">
</head>
<body>
<div class="container mt-3">
<h2>按钮样式</h2>
<button type="button" class="btn">基本按钮</button>
<button type="button" class="btn btn-primary">主要按钮</button>
<button type="button" class="btn btn-secondary">次要按钮</button>
<button type="button" class="btn btn-success">成功</button>
<button type="button" class="btn btn-info">信息</button>
<button type="button" class="btn btn-warning">警告</button>
<button type="button" class="btn btn-danger">危险</button>
<button type="button" class="btn btn-dark">黑色</button>
<button type="button" class="btn btn-light">浅色</button>
<button type="button" class="btn btn-link">链接</button>
</div>
<div class="container mt-3">
<h2>按钮元素</h2>
<a href="#" class="btn btn-info" role="button">链接按钮</a>
<button type="button" class="btn btn-info">按钮</button>
<input type="button" class="btn btn-info" value="输入框按钮">
<input type="submit" class="btn btn-info" value="提交按钮">
<input type="reset" class="btn btn-info" value="重置按钮">
</div>
<div class="container mt-3">
<h2>按钮设置边框</h2>
<button type="button" class="btn btn-dark btn-outline-primary">主要按钮</button>
<button type="button" class="btn btn-outline-secondary">次要按钮</button>
<button type="button" class="btn btn-outline-success">成功</button>
<button type="button" class="btn btn-outline-info">信息</button>
<button type="button" class="btn btn-outline-warning">警告</button>
<button type="button" class="btn btn-outline-danger">危险</button>
<button type="button" class="btn btn-outline-dark">黑色</button>
<button type="button" class="btn btn-outline-light text-dark">浅色</button>
</div>
<div class="container mt-3">
<h2>不同大小的按钮</h2>
<button type="button" class="btn btn-primary btn-lg">大号按钮</button>
<button type="button" class="btn btn-primary">默认按钮</button>
<button type="button" class="btn btn-primary btn-sm">小号按钮</button>
</div>
<div class="container mt-3">
<p>通过添加 .btn-block 类可以设置块级按钮,.d-grid 类设置在父级元素中:</p>
<div class="d-grid">
<button type="button" class="btn btn-primary btn-block">按钮 1</button>
</div>
</div>
<div class="container mt-3">
<p>通过添加 .btn-block 类可以设置块级按钮,.d-grid 类设置在父级元素中:</p>
<div class="d-grid gap-3">
<button type="button" class="btn btn-primary btn-block">100% 宽度的按钮</button>
<button type="button" class="btn btn-primary btn-block">100% 宽度的按钮</button>
<button type="button" class="btn btn-primary btn-block">100% 宽度的按钮</button>
</div>
</div>
<div class="container mt-3">
<h2>按钮状态</h2>
<button type="button" class="btn btn-primary">主要按钮</button>
<button type="button" class="btn btn-primary active">点击后的按钮</button>
<button type="button" class="btn btn-primary" disabled>禁止点击的按钮</button>
<a href="#" class="btn btn-primary disabled">禁止点击的链接</a>
</div>
<div class="container mt-3">
<h2>加载按钮</h2>
<p>按钮添加正在加载按钮:</p>
<button class="btn btn-primary">
<span class="spinner-border spinner-border-sm"></span>
</button>
<button class="btn btn-primary">
<span class="spinner-border spinner-border-sm"></span>
Loading..
</button>
<button class="btn btn-primary" disabled>
<span class="spinner-border spinner-border-sm"></span>
Loading..
</button>
<button class="btn btn-primary" disabled>
<span class="spinner-grow spinner-grow-sm"></span>
Loading..
</button>
</div>
</body>
</html>
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/5b13291058141984499b2c135e487fb9.png)