使用 Bootstrap 在單行中組合按鈕


在 Bootstrap 中使用 .btn-group 類在單行中組合按鈕。

你可以嘗試執行以下程式碼在 Bootstrap 中實現 .btn-group

示例

線上演示

<!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 the car brands:</p>
      <div class = "btn-group">
         <button type = "button" class = "btn btn-default">BMW</button>
         <button type = "button" class = "btn btn-default">Audi</button>
         <button type = "button" class = "btn btn-default">Jeep</button>
         <button type = "button" class = "btn btn-default">Datsun</button>
         <button type = "button" class = "btn btn-default">Toyota</button>
         <button type = "button" class = "btn btn-default">Mahindra</button>
      </div>
   </body>
</html>

更新日期:12-Jun-2020

3 千+ 瀏覽量

啟動你的 職業

完成課程獲得認證

開始
廣告
© . All rights reserved.