我想簡單地使圖像覆蓋導航欄,但我現在很困惑如何做到這一點。我如何覆蓋導航欄上的圖像?
圖片
目前導航欄和所述圖像是獨立的,如果可能的話我想要導航欄的背景爲圖像以及
HTML代碼
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" 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="#">Start Bootstrap</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
<a href="#about">About</a>
</li>
<li>
<a href="#services">Services</a>
</li>
<li>
<a href="#contact">Contact</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<!-- Full Width Image Header -->
<header class="header-image">
<div class="headline">
<div class="container">
<h1>join our movement!</h1>
<!-- <h3>Join Now</h3> -->
<button class="btn btn-success btn-lg">Join Now</button>
<!-- <button type="button" class="btn btn-primary btn-md">Medium</button> -->
</div>
</div>
</header>
Css代碼
.header-image {
display: block;
width: 100%;
height: auto;
text-align: center;
background-image: url("/images/cloud6.jpg");
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}
使用z-index和定位,然後設置不透明度以便透視? – Li357