Bootstrap 下拉類


下拉選單是可切換的上下文選單,用於以列表格式顯示連結。要使用下拉選單,只需將下拉選單包裹在類 .dropdown 中即可。

可以嘗試執行以下程式碼,以便在 Bootstrap 中實現下拉類

示例

實際演示

<!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 = "dropdown">
         <button type = "button" class = "btn dropdown-toggle" id = "dropdownMenu1" data-toggle = "dropdown">
            Subjects
            <span class = "caret"></span>
         </button>
         <ul class = "dropdown-menu" role = "menu" aria-labelledby = "dropdownMenu1">
            <li role = "presentation">
               <a role = "menuitem" tabindex = "-1" href = "#">Java</a>
            </li>
            <li role = "presentation">
               <a role = "menuitem" tabindex = "-1" href = "#">Data Mining</a>
            </li>
            <li role = "presentation">
               <a role = "menuitem" tabindex = "-1" href = "#">
                  C++
               </a>
            </li>
            <li role = "presentation" class = "divider"></li>
            <li role = "presentation">
               <a role = "menuitem" tabindex = "-1" href = "#">Separated link</a>
            </li>
         </ul>
      </div>
   </body>
</html>

更新日期: 2020 年 6 月 12 日

258 次瀏覽

開啟您的 職業生涯

完成該課程以獲得認證

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