我想在我的引导页面上方有一个横幅。我的代码在
之下HTML
<div class="masthead">
<img src="images/gov-header.jpg"/>
</div>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<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="#">MST</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="index.html">Home</a></li>
<li><a href="content.html">Divisions</a></li>
<li><a href="#projects">Projects</a></li>
<li><a href="#faqs">FAQs</a></li>
<li><a href="#resources">Resources</a></li>
<li><a href="#contact">Contact Us</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
CSS
.masthead img{
width:100%;
}
答案 0 :(得分:6)
它作为背景更好。
.masthead{
height://height of bg;
background-image:url("../images/gov-header.jpg");
background-repeat:no-repeat;
}
希望这会给你一些想法。您可以根据您是要填充整个宽度还是仅填充容器长度来修改它。
<强>更新强> 你必须改变
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
到
<div class="navbar navbar-inverse" role="navigation">