在 Bootstrap 中创建可撤销告警
要创建可撤销告警,请执行以下操作:
- 通过创建一个包装 <<div> 并添加 .alert 的类以及四个上下文类之一(例如,.alert-success、.alert-info 等),添加基本告警。
- 另外,向以上 <div> 类添加可选的 .alert-dismissable。
- 添加一个关闭按钮。
你可以尝试运行以下代码来创建可撤销告警:
示例
<!DOCTYPE html> <html> <head> <title>Bootstrap Example</title> <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet"> <script src = "/scripts/jquery.min.js"></script> <script src = "/bootstrap/js/bootstrap.min.js"></script> </head> <body> <div class = "alert alert-success alert-dismissable"> <button type = "button" class = "close" data-dismiss = "alert" aria-hidden = "true"> × </button> Success! Well done its submitted. </div> <div class = "alert alert-info alert-dismissable"> <button type = "button" class = "close" data-dismiss = "alert" aria-hidden = "true"> × </button> Info! Take this info. </div> </body> </html>
广告