源代码:
下载代码
AI 编程工具
点击运行
<!DOCTYPE html> <html> <head> <title>Bootstrap5 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="https://cdn.staticfile.net/twitter-bootstrap/5.1.1/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.staticfile.net/twitter-bootstrap/5.1.1/js/bootstrap.bundle.min.js"></script> </head> <body> <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> </body> </html>
运行结果: