W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!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://cdn.jsdelivr.net/npm/bootstrap@5.1.2/dist/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.2/dist/js/bootstrap.bundle.min.js"></script> </head> <body> <div class="container mt-3"> <h3>大型实例</h3> <p>请单击按钮打开模态。</p> <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#myModal"> 打开模态 </button> </div> <!-- 模态 --> <div class="modal" id="myModal"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <!-- 模态标题 --> <div class="modal-header"> <h4 class="modal-title">模态标题</h4> <button type="button" class="btn-close" data-bs-dismiss="modal"></button> </div> <!-- 模态主体 --> <div class="modal-body"> 模态主体 .. </div> <!-- 模态页脚 --> <div class="modal-footer"> <button type="button" class="btn btn-danger" data-bs-dismiss="modal">关闭</button> </div> </div> </div> </div> </body> </html>