Using bootstrap 3. I have a full-screen hero/intro section that has a background pattern.
WHAT I WANT:
What I want it to look like (navbar-fixed-top style):
WHAT HAPPENS:
Any idea how I could accomplish this without giving the hero section a negative margin?
My HTML:
<nav class="navbar navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-main-collapse">
<i class="fa fa-bars"></i>
</button>
<div class="navbar-brand" href="#page-top">
<img src="http://placehold.it/200x80" alt=" Logo" width="100">
</div>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div id="navbar-main-collapse" class="collapse navbar-collapse navbar-right">
<ul class="nav navbar-nav">
<li class="active"><a href="..." target="_blank"><i class="fa fa-folder-open"></i> Link 1</a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<section id="hero" class="full-screen-section">
<div class="cell-mid">
<div class="section-body">
<div class="container">
<div class="row">
<div class="col-md-2 col-md-offset-1 text-right">
<img src="http://placehold.it/300x120" id="faceOne" class="img-max hidden-xs hidden-sm">
</div>
<div class="col-md-6 text-left">
<h1 class="brand-heading">EXAMPLE HEADING</h1>
</div>
<div class="col-md-2 text-left">
<img src="http://placehold.it/300x120" id="faceTwo" class="img-max hidden-xs hidden-sm">
</div>
</div>
</div>
</div>
</div>
</section>
My CSS:
/* --------------- Nav --------------- */
.navbar {
padding: 1em 0;
margin-bottom: 0;
border: none;
text-transform: uppercase;
background-color: transparent;
background-image: none;
}
.navbar a {
color:#fff;
}
/* --------------- Hero --------------- */
#hero {
display: table;
width: 100%;
height: 100%;
padding: 200px 0 50px 0;
text-align: center;
color: #fff;
background: linear-gradient(
rgba(248, 153, 153, 0.68),
rgba(248, 153, 153, 0.68)), url('bg-science.png');
-webkit-box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.5);
-moz-box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.5);
box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.5);
}
EDIT: Solution found, thanks to @airbean. Just used the navbar-fixed-top class and added "position: absolute" on the navbar class.
Set the navbar fixed to the top, add class . navbar-fixed-top to the . navbar class.
To make the nav bar and top bar scroll normally, you may go to Appearance > Customize > Header > Navbar Position > Select: Static Top.
Use the .sticky-top class to make the navbar fixed/stay at the top of the page when you scroll past it.
@Aibrean helped out. I used the navbar-fixed-top class and added "position: absolute" on the navbar class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With