我尝试在Bootstrap 4导航栏中使用背景图像,我觉得很难。我看了几个代码,但没有工作。
我也试过在导航栏之前添加一个div,看看是否会解决它,它仍然没有。
我正在使用Bootstrap 4 Beta 2.我可能做错了什么?
html,
body {
height: 100%;
}
body {
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
color: #6c6f73;
font-size: 0.9rem;
background-color: #EEE;
}
.header-feature {
min-height:400px;
background: #201D1D url('assets/img/bg/engineer-background.png');
//background: #222 url('assets/img/bg/engineer-background.png') center center no-repeat;
// background: url('assets/img/bg/engineer-background.png');
background-size: cover;
color: #FFF;
font-size: 0.8rem;
padding: 0.5rem;
}
.header-feature p {
font-size: 1rem;
}

<div class="header-feature ">
<nav class="navbar navbar-expand-lg ">
<a class="navbar-brand" href="#"><img src="assets/img/logo.png" height="50" /></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="#"> <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">FOR HR</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">SIGNUP</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">LOGIN</a>
</li>
</ul>
</div>
</nav>
<div class="header-div">
<!-- <img src="assets/img/bg/engineer-background.png" /> -->
<h1>Are you in the groove?</h1>
<p>
Share with us
</p>
<a href="#" role="button" class="btn btn-lg btn-success">Get Started</a>
</div>
</div>
&#13;