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

更新於: 12-Jun-2020

321 瀏覽

啟動您的 職業生涯

完成課程,獲取認證

開始學習
廣告
© . All rights reserved.