Bootstrap⾃适应导航栏(带搜索框)
使⽤Bootstrap创建的导航栏,最为原始的,没有任何的⾃定义颜⾊什么的
电脑版样图
⼿机版样图
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!--声明⽂档兼容模式,表⽰使⽤IE浏览器的最新模式-->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--Responsive layout:响应式布局-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>蜗壳</title>
<!-- 引⼊Bootstrap核⼼样式⽂件 -->
<link href="cdn.static.runoob/libs/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<!-- 添加navbar-fixed-top可以让导航条⼀直固定在顶部,不会因为滚动条改变⽽改变,navbar-inverse让导航条⿊底展⽰ -->
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
  <div class="container">  <!-- container让导航条居中container-fluid让导航条⾃适应 --> 
    <div class="navbar-header">
      <!-- 代表响应式布局:当浏览器宽度⼩于某个值时导航栏折叠变成三道杠 -->
<button class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" type="button">                <span class="sr-only navbar-left">切换导航</span>
<span class="icon-bar navbar-left"></span>
<span class="icon-bar navbar-left"></span>
<span class="icon-bar navbar-left"></span>
</button>
<!-- //代表导航栏左侧logo或者图标  -->
      <!-- <a class="navbar-brand" href="www.baidu">浏览器博物馆</a> -->
<span class="navbar-brand">蜗壳</span>
</div>
    <!-- //导航条内容,为了响应式布局,点击三道杠弹出导航栏 -->
<div>
        <!-- //代表导航栏中的项⽬ -->
      <ul class="nav navbar-nav collapse navbar-collapse" id="bs-example-navbar-collapse-1">
js导航栏下拉菜单
<li><a href="www.baidu"><span class="glyphicon glyphicon-home"></span>⼆⼿市场</a></li>
<li><a href="www.baidu"><span class="glyphicon glyphicon-globe"></span>活⼒圈⼦</a></li>
<li><a href="www.baidu"><span class="glyphicon glyphicon-bell"></span>消息列表</a></li>
<li><a href="www.baidu"><span class="glyphicon glyphicon-user"></span>个⼈中⼼</a></li>
</ul>
<!-- 搜索框 -->
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
<button type="submit" class="btn btn-default">搜索</button>
</div>
</form>
<!-- 登录注册 -->
<!-- <ul class="nav navbar-nav navbar-right">
<li><a href="#"><span class="glyphicon glyphicon-user"></span> 登录</a></li>
<li><a href="#"><span class="glyphicon glyphicon-log-in"></span> 登录</a></li>
</ul> -->
</div>
</div>
</nav>
<!-- 引⼊jQuery核⼼js⽂件 -->
<script src="cdn.static.runoob/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- 引⼊BootStrap核⼼js⽂件 -->
<script src="cdn.static.runoob/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。