I'm making a web page using bootstrap and i have encountered the following problem with the navbar and the content of the page overlapping. When viewing the page normally everything works fine but the problem occurs when displayed on mobile and a tablet.
What I want to achieve is that when the dropdown button for the navbar is clicked I want the rest of the content to move down. I don't just want to overlay the content with the navbar.
This is my code:
HTML:
<nav class="navbar navbar-default navbar-custom navbar-centered" role="navigation">
<div class="container-fluid glavni-meni">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<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="index.html">MNZ Maribor</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="">Tekmovanja</a></li>
<li><a href="">Klubi</a></li>
<li><a href="">Reprezentance</a></li>
<li><a href="">Grassroots</a></li>
<li><a href="">Klub Klubu</a></li>
<li><a href="">Obrazci in predpisi</a></li>
<li><a href="">Trenerji in sodniki</a></li>
<li><a href="">Delegati</a></li>
<li><a href="">Razno</a></li>
<li><a href="">Ugodnosti</a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<!--Main content of page-->
<section id="main-content">
<div class="container nekaj">
<div class="col-lg-2 col-md-2 navigation">
content content content content content content content content content content content content
</div>
<!--Beginning of carousel-->
<div class="col-md-10 col-md-10 galery">
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="img/example.jpg" alt="Los Angeles">
</div>
<div class="item">
<img src="img/example.jpg" alt="Chicago">
</div>
<div class="item">
<img src="img/example.jpg" alt="New York">
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
</section>
And my CSS:
.navbar-nav {
width: 100%;
>li {
float: none;
display: inline-block;
}
}
.navbar {
margin-top: 0px;
margin-bottom: 0px;
border: none;
border-radius: 0px;
font-family: 'Abel', sans-serif;
font-size: 18px;
font-weight: 600;
text-transform: uppercase;
text-decoration: none;
}
.navbar-toggle{
border-color: #002d68 !important;
background-color: #ffff01 !important;
}
.navbar-default .navbar-toggle:hover {
background-color: #ffff01 !important;
}
.navbar-toggle .icon-bar{
background-color: #002d68 !important;
}
.navbar-brand{
color: #002d68 !important;
}
.navbar-default {
background-color: #ffff01;
height: 40px;
}
.navbar-default .navbar-nav>li>a {
color: #002d68 !important;
}
.glavni-meni {
background-color: #ffff01;
}
#main-content{
background-image: url('../img/football-field.jpg');
background-repeat:no-repeat;
}
And my mobile CSS:
@media (min-width: 768px) {
.navbar-brand {
display: none;
}
.navbar-centered .navbar-nav {
float: none;
text-align: center;
}
.navbar-centered .navbar-nav>li {
float: none;
}
.navbar-centered .nav>li {
display: inline;
}
.navbar-centered .nav>li>a {
display: inline-block;
}
.container-fluid {
padding-right: 80px;
padding-left: 80px;
}
}