Bootstrap navbar-btn 類的用法


使用 class .navbar-btn 向未駐留在 <form> 中的 <button> 元素新增按鈕以使其垂直居中在導航欄中。 .navbar-btn 可用於 <a> 和 <input> 元素。

你可以嘗試執行以下程式碼來實現 navbar-btn 類

示例

即時演示

<!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>
      <nav class = "navbar navbar-default" role = "navigation" style="background: #85C1E9;">
         <div class = "navbar-header">
            <a class = "navbar-brand" href = "#">Search below:</a>
         </div>
         <div>
            <form class = "navbar-form navbar-left" role = "search">
               <div class = "form-group">
                  <input type = "text" class = "form-control" placeholder = "Search">
               </div>
               <button type = "submit" class = "btn btn-default">Submit Button</button>
            </form>
            <button type = "button" class = "btn btn-default navbar-btn">Navbar Button</button>
         </div>
      </nav>
   </body>
</html>

更新於: 12-6-2020

443 次瀏覽

開啟你的 職業

完成課程即可獲得認證

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