我正在尝试使我的导航栏位于bootstrap 4.0中的背景图像之上。我可以通过背景图片上的负边距顶部来完成此操作,但是如果我对自己的网站进行了更改,则操作起来并不容易。
HTML:
<div class="masthead">
<nav>
<img src="https://test.io/wp-content/uploads/2019/02/testIO-logo-rgb-2.png" class="site-logo" />
</nav>
</div>
<div class="container-fluid hero"> </div>
CSS:
.hero {
height: 600px;
background-image: url(https://s17736.pcdn.co/wp-content/uploads/2019/03/asoggetti-318284-unsplash-1024x684.jpg);
background-position: center center;
width: 100%;
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
margin-bottom: 15px;
}
nav {
background: transparent;
background-attachment: fixed;
background-position: auto,center;
}
.site-logo {
height: 64px;
}