Having a slight problem with the positioning of my navbar. I have my navbar the way I would like (detached from the top slightly like in this example: http://getbootstrap.com/examples/carousel/) but the pictures in my carousel end below the navbar.
I would like for the pictures in my carousel to extend all the way to the top of the page and have the navbar overlapping the upper portion of the carousel (like in the example above). I've played around with the padding but the highest I can get the carousel images to extend to are the bottom of the navbar. I've attached the code snippets for the navbar, carousel and carousel css below. Any help would be appreciate, thanks in advance
Code for Navbar:
<div class="container">
<div class="navbar navbar-inverse" role="navigation"> <!navbar-inverse is black, navbar-default is grey>
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<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">Derby Days 2014</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Donate</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Events <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Penny Wars</a></li>
<li><a href="#">Wonderful Wednesday</a></li>
<li><a href="#">Lip Sync</a></li>
<li><a href="#">Concert</a></li>
</ul>
</li>
<li><a href="#">FAQ</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
Code for Carousel:
CSS code for carousel:
.carousel {position: relative;}
.carousel-inner {position: relative; width: 100%; overflow: hidden;}
Just remove your custom stylesheet and you will be fine.
I believe this is what you are trying to achieve?
Js Fiddle
.bannerContainer {
position:relative;
}
.carousel {
position:absolute;
top:0;
}
.navbar {
position:absolute;
top:30px;
z-index:10;
background:#fff;
width:100%;
}
You want to wrap absolute positioned divs (nav and carousel) into a div that is relative.
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