在 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>
广告