我想简单地让图像覆盖导航栏,但我现在真的很困惑如何做到这一点。
图片
目前导航栏和图像是分开的,如果可能的话,我希望导航栏的背景也是图像
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;
}
答案 0 :(得分:1)
将导航栏类背景设置为透明.navbar { background : transparent; }
为标题图像设置负边距,如下所示;
.header-image { margin-top : -40px};
为例
答案 1 :(得分:0)
您可以尝试将导航栏放入标题图像,并将导航栏的背景设置为无或透明。
interface Command:Object
def abstract execute()
祝你好运!