Boostrap .dropup 類


選單不僅可以向下展開,也可以向上展開。要實現此效果,只需將 .dropup 新增到父 .btn-group 容器即可。

可嘗試執行以下程式碼集,使菜單向上展開

示例

即時演示

<!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>
      <p>Dropup</p>
      <div class = "row" style = "margin-left:50px; margin-top:120px">
         <div class = "btn-group dropup">
            <button type = "button" class = "btn btn-primary dropdown-toggle" data-toggle = "dropdown">
               Subject
               <span class = "caret"></span>
            </button>
            <ul class = "dropdown-menu" role = "menu">
               <li><a href = "#">Programming</a></li>
               <li><a href = "#">Web Dev</a></li>
               <li><a href = "#">Database</a></li>
               <li><a href = "#">Networking</a></li>
            </ul>
         </div>
      </div>
   </body>
</html>

更新時間:2020 年 6 月 12 日

214 次瀏覽

助力你的職業道路

獲取課程認證

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