当前阅读教程:Bootstrap4教程 > Bootstrap4 信息提示框 | |
阅读(22555525) 收藏 赞(5685) 分享 | |
上一篇: Bootstrap4 Jumbotron 超大屏幕 | 下一篇: 提示框添加链接 alert-link 类 |
Bootstrap 4 可以很容易实现信息提示框。 提示框可以使用 .alert 类, 后面加上 .alert-success, .alert-info, .alert-warning, .alert-danger, .alert-primary, .alert-secondary, .alert-light 或 .alert-dark 类来实现: 实例 <div class="alert alert-success"> <strong>成功!</strong> 指定操作成功提示信息。 </div> 完整代码 <!DOCTYPE html> <html> <head> <title>Bootstrap 实例(小白教程网 2d5.net)</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css"> <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script> <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script> </head> <body> <div> <h2>提示框</h2> <p>提示框可以使用 .alert 类, 后面加上指定特定意义的颜色类来实现:</p> <div class="alert alert-success"> <strong>成功!</strong> 指定操作成功提示信息。 </div> <div class="alert alert-info"> <strong>信息!</strong> 请注意这个信息。 </div> <div class="alert alert-warning"> <strong>警告!</strong> 设置警告信息。 </div> <div class="alert alert-danger"> <strong>错误!</strong> 失败的操作 </div> <div class="alert alert-primary"> <strong>首选!</strong> 这是一个重要的操作信息。 </div> <div class="alert alert-secondary"> <strong>次要的!</strong> 显示一些不重要的信息。 </div> <div class="alert alert-dark"> <strong>深灰色!</strong> 深灰色提示框。 </div> <div class="alert alert-light"> <strong>浅灰色!</strong>浅灰色提示框。 </div> </div> </body> </html> 效果图 |
|
上一篇: Bootstrap4 Jumbotron 超大屏幕 | 下一篇: 提示框添加链接 alert-link 类 |