<nav class="navbar navbar-default" style="border-color: transparent;">
<div class="container">
<div class="navbar-header">
<!-- 自适应隐藏导航展开按钮 -->
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">
<img src="data:images/docker.png">
</a> </div>
<!--一定要加上id="bs-example-navbar-collapse-1"属性,不然小屏幕的情况下,li链接不可见 -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1" style="margin-top: 12px;">
<ul class="nav navbar-nav">
<li><a href="#"><strong>What is Docker?</strong></a></li>
<li><a href="#"><strong>Use Cases</strong></a></li>
<li><a href="#"><strong>Try It!</strong></a></li>
<li><a href="#"><strong>Install & Docs</strong></a></li>
<li><a href="#"><strong>Browse</strong></a></li>
</ul>
<!-- 搜索框-->
<form class="navbar-form navbar-right" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search"/>
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div><!--/.collapse--> </div><!--/.container -->
</nav>
效果图如下:
适应大屏
适应小屏