警告框組件通過提供一些靈活的預定義消息,為常見的用戶動作提供反饋消息。
將任意文本和一個可選的關閉按鈕組合在一起就能組成一個警告框,.alert
類是必須要設置的,另外我們還提供了有特殊意義的4個類(例如,.alert-success
),代表不同的警告信息。
<div class= "alert alert-success" role= "alert" > ... </div> <div class= "alert alert-info" role= "alert" > ... </div> <div class= "alert alert-warning" role= "alert" > ... </div> <div class= "alert alert-danger" role= "alert" > ... </div>
為警告框添加一個可選的.alert-dismissible
類和一個關閉按鈕。
<div class= "alert alert-warning alert-dismissible" role= "alert" > <button type= "button" class= "close" data-dismiss= "alert" aria-label= "Close" ><span aria- hidden= "true" > × </span></button> <strong> Warning! </strong> Better check yourself, you're not looking too good. </div>