I am making a project at school and I am using Bootstrap 4 and I am pretty new to it.
I have my navbar brand as an image centered in the middle of the navbar. But when I switch over to a smaller screen some of the navbar items get moved down under the navbar. And that also creates a space between the carousel and the navbar.
I suspect that it is because of the "absolute" position of the navbar brand image.
Here is a Jsfiddle: jsfiddle(dot)net/zdu9jv99/3/ I don't know why it isn't fully working..... (I can't post more than two links, that's why I have to do the (dot).)
This is what it looks like on smaller displays. Image that shows the overlapping This is how it is supposed to look like. This is how it looks on bigger screens Here is my html and css:
<!DOCTYPE html>
<html lang="sv">
<head>
<title>Barber Shop</title>
<meta charset="utf-8">
<!-- Icon -->
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Bootstrap Core CSS -->
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<!-- Font-Awesome Core CSS -->
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
<!-- Custom CSS -->
<link rel="stylesheet" href="assets/css/style.css">
</head>
<body>
<header>
<!-- Navigation -->
<nav class="navbar navbar-dark bg-inverse navbar-static-top navbar-full" style="background-color: #d8c387 !important;">
<div class="container">
<div class="row">
<div class="col-md-4">
<ul class="nav navbar-nav">
<li class="nav-item"><a class="nav-link" href="index.html"><i class="fa fa-home icon-padding" aria-hidden="true"></i>Hem</a></li>
<li class="nav-item"><a class="nav-link" href="hittafrisor.html"><i class="fa fa-map-marker icon-padding" aria-hidden="true"></i>Hitta frisör</a></li>
<li class="nav-item"><a class="nav-link" href="#"><i class="fa fa-picture-o icon-padding" aria-hidden="true"></i>Galleri</a></li>
</ul>
</div>
<div class="col-md-2">
<div class="navbar-brand">
<a class="white-circle" href="index.html">
<img class="img-fluid" src="assets/images/barber-logo.png" alt="Logo">
</a>
</div>
</div>
<div class="col-md-6">
<ul class="nav navbar-nav float-md-right">
<li class="nav-item"><a class="nav-link" href="#"><i class="fa fa-info icon-padding" aria-hidden="true"></i>Om oss</a></li>
<li class="nav-item"><a class="nav-link" href="#"><i class="fa fa-phone icon-padding" aria-hidden="true"></i>Kontakt</a></li>
</ul>
</div>
</div>
</div>
</nav>
</header>
<main>
css:
/* NAVBAR */
.navbar {
height: 58px;
z-index: 2 !important;
}
.navbar-brand {
display: inline-block;
float: none;
padding: 0;
margin: 0 !important;
overflow: visible;
}
.navbar-brand img {
z-index: 3 !important;
}
.navbar-brand .white-circle {
display: block;
width: 161px;
height: 10px;
border-radius: 50%;
position: absolute;
}
.navbar {
text-align: center;
}
.nav-link {
color: #741833 !important;
}
/* NAVBAR FONT SIZE */
.nav a{
font-size: 17px;
}
I have also uploaded the project to as site, if you want to look at the whole thing. If you have any other opinions or anything else feel free the critique me, I am sure that I have made some more mistakes. The site is cpt-keyhole.se (yes I know a strange name)
It probably just is an easy thing that i have missed or misunderstood, so I would appreciate some your help. Thanks for your time!
One of the link from left menus is dropping down because of limited space in its parent div.
You need to increase width of left navigation links on mobile devices like: