Bootstrap navbar-fixed-top 類的用法


使用 Bootstrap 類 .navbar-fixed-top 將導航欄固定到頂部。

你可以嘗試執行以下程式碼將導航欄固定到頂部 -

範例

即時演示

<!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 navbar-fixed-top" role = "navigation" style="background: red;">
         <div class = "navbar-header">
            <a class = "navbar-brand" href = "#">Modes of Transport</a>
         </div>
         <div>
            <ul class = "nav navbar-nav">
               <li class = "active"><a href = "#">Air Transport</a></li>
               <li><a href = "#">Water Transport</a></li>
            </ul>
         </div>
      </nav>
   </body>
</html>

更新於: 12-6-2020

328 次瀏覽

開啟你的職業生涯

完成課程,獲得認證

開始
廣告
© . All rights reserved.