I am trying to create a full page with a background image with a navigation bar that floats on top of the image.
I have a problem that navbar pushes the image down, the image is set against the background of the html element, so I do not know why navbar has this effect.
I just use css right from the bootstrap start page, and without a navigation bar, the image matches the entire page, with the navigation bar above the image and pushing it down:
Css:
html{
background:url('bg.jpg') no-repeat center center;
min-height:100%;
background-size:cover;
}
body {
min-height:100%;
padding-top: 20px;
padding-bottom: 20px;
}
.navbar {
margin-top: 0px;
margin-bottom: 0px;
}
Html:
<body>
<div class="container">
<nav class="navbar navbar-default navbar-custom" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-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" href="#">Brand</a>
</div>
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
</div>
The effect I want to finish is the image of the entire page, and the navigation bar sits with the image depicting below it, rather than pushing the image down, so that it starts after the navigation bar.