.alert-success
.alert-info
.alert-warning
.alert-danger
<!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h2>Alerts</h2> <div class="alert alert-success"> <strong>Success!</strong> this alert box indicates a successful or positive action. </div> <div class="alert alert-info"> <strong>Info!</strong> this alert box indicates a neutral informative change or action. </div> <div class="alert alert-warning"> <strong>Warning!</strong> this alert box indicates a warning that might need attention. </div> <div class="alert alert-danger"> <strong>Danger!</strong> this alert box indicates a dangerous or potentially negative action. </div> </div> </body> </html>
Primary: 该警报框表示重要的操作。
Secondary: 此警报框指示次要操作。
Dark: 深灰色警报框。
Light: 浅灰色警报框。
.alert-success
.alert-info
.alert-warning
.alert-danger
.alert-primary
.alert-secondary
.alert-light
.alert-dark
<!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.6/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h2>Alerts</h2> <div class="alert alert-success"> <strong>Success!</strong> Used to indicate successful or positive action. </div> <div class="alert alert-info"> <strong>Info!</strong> Used to indicate a neutral informative change or action. </div> <div class="alert alert-warning"> <strong>Warning!</strong> Used to indicate a warning that might need attention. </div> <div class="alert alert-danger"> <strong>Danger!</strong> Used to indicate a dangerous or potentially negative action. </div> <div class="alert alert-primary"> <strong>Primary!</strong> Used to indicate an important action. </div> <div class="alert alert-secondary"> <strong>Secondary!</strong> Used to indicate a slightly less important action. </div> <div class="alert alert-dark"> <strong>Dark!</strong> Dark grey alert. </div> <div class="alert alert-light"> <strong>Light!</strong> Light grey alert. </div> </div> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.6/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h2>Bootstrap Alert Links</h2> <div class="alert alert-success"> <strong>Success!</strong> You should <a href="#" class="alert-link">read this message</a>. </div> <div class="alert alert-info"> <strong>Info!</strong> You should <a href="#" class="alert-link">read this message</a>. </div> <div class="alert alert-warning"> <strong>Warning!</strong> You should <a href="#" class="alert-link">read this message</a>. </div> <div class="alert alert-danger"> <strong>Danger!</strong> You should <a href="#" class="alert-link">read this message</a>. </div> <div class="alert alert-primary"> <strong>Primary!</strong> You should <a href="#" class="alert-link">read this message</a>. </div> <div class="alert alert-secondary"> <strong>Secondary!</strong> You should <a href="#" class="alert-link">read this message</a>. </div> <div class="alert alert-dark"> <strong>Dark!</strong> You should <a href="#" class="alert-link">read this message</a>. </div> <div class="alert alert-light"> <strong>Light!</strong> You should <a href="#" class="alert-link">read this message</a>. </div> </div> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.6/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h2>Alerts</h2> <div class="alert alert-success alert-dismissable"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Success!</strong> this alert box could indicate a successful or positive action. </div> <div class="alert alert-info alert-dismissable"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Info!</strong> this alert box could indicate a neutral informative change or action. </div> <div class="alert alert-warning alert-dismissable"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Warning!</strong> this alert box could indicate a warning that might need attention. </div> <div class="alert alert-danger alert-dismissable"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Danger!</strong> this alert box could indicate a dangerous or potentially negative action. </div> <div class="alert alert-primary alert-dismissable"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Primary!</strong> Indicates an important action. </div> <div class="alert alert-secondary alert-dismissable"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Secondary!</strong> Indicates a slightly less important action. </div> <div class="alert alert-dark alert-dismissable"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Dark!</strong> Dark grey alert. </div> <div class="alert alert-light alert-dismissable"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Light!</strong> Light grey alert. </div> </div> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.6/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h2>Animated Alerts Example</h2> <div class="alert alert-success alert-dismissable fade show"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Success!</strong> this alert box could indicate a successful or positive action. </div> <div class="alert alert-info alert-dismissable fade show"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Info!</strong> this alert box could indicate a neutral informative change or action. </div> <div class="alert alert-warning alert-dismissable fade show"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Warning!</strong> this alert box could indicate a warning that might need attention. </div> <div class="alert alert-danger alert-dismissable fade show"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Danger!</strong> this alert box could indicate a dangerous or potentially negative action. </div> <div class="alert alert-primary alert-dismissable fade show"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Primary!</strong> Indicates an important action. </div> <div class="alert alert-secondary alert-dismissable fade show"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Secondary!</strong> Indicates a slightly less important action. </div> <div class="alert alert-dark alert-dismissable fade show"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Dark!</strong> Dark grey alert. </div> <div class="alert alert-light alert-dismissable fade show"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Light!</strong> Light grey alert. </div> </div> </body> </html>