使用 Bootstrap 為元素增加綠色背景色可設定為肯定操作


在 Bootstrap 中使用 class .btn-success 可為元素設定肯定操作。你可以嘗試執行以下程式碼以實現 class .btn-success −

示例

實況演示

<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link rel = "stylesheet" href = "https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css">
      <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
      <script src = "https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
   </head>
   <body>
      <p>The following are FMCG companies:</p>
      <div class = "btn-default">
         <button type = "button" class = "btn btn-primary">ITC Limited</button>
         <button type = "button" class = "btn btn-primary">Nestle</button>
         <button type = "button" class = "btn btn-primary">Britannia Industries Limited</button>
      </div>
      <p>Click below if the above list is correct:</p>
      <button type = "button" class = "btn btn-success">Success</button>
   </body>
</html>

更新於:12-Jun-2020

129 次瀏覽

開啟您的 職業生涯

完成課程以取得認證

開始
廣告