I'm trying to move the language switcher and it's items to the right end of the page. I tried ml-auto but it didn't work.
When I try to move the language picker using padding-left all of its items appear in the center of the page. Any solutions or advices?Here is how my web-page looks like.
.navbar-nav {
margin: 0 auto;
}
.nav-link {
font-weight: 900;
font-size: 1rem;
float: right;
}
#top-nav {
position: absolute;
z-index: 3;
width: 100%;
background-color: transparent !important;
}
#logo {
width: 100px;
height: 50px;
margin-left: 0;
padding-left: 0;
}
.flag-icon {
border-radius: 50%;
}
.navbar-light .navbar-toggler {
color: #FFFFFF;
border-color: #FFFFFF;
}
<nav class="navbar navbar-expand-lg navbar-light bg-light" id="top-nav">
<a class="navbar-brand" id="logo" href="index.html">
<img src="media/logo_light.svg" />
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<i class="fas fa-bars"></i>
</button>
<div class="collapse navbar-collapse " id="navbarNav">
<ul class="navbar-nav">
<li id="main" class="nav-item active ">
<a class="nav-link text-light" href="#">მთავარი<span class="sr-only">(current)</span></a>
</li>
<li id="about-us" class="nav-item">
<a class="nav-link text-light" href="#">ჩვენ შესახებ</a>
</li>
<li id="services" class="nav-item">
<a class="nav-link text-light" href="#">სერვისები</a>
</li>
<li id="contact" class="nav-item">
<a class="nav-link text-light " href="#">კონტაქტი</a>
</li>
<li class="nav navbar-nav nav-item dropdown justify-content-end">
<a class="nav-link dropdown-toggle" href="#" id="dropdown09" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="flag-icon flag-icon-ge"></span></a>
<div class="dropdown-menu" aria-labelledby="dropdown09">
<a class="dropdown-item nav-link" href="#gb"><span class="flag-icon flag-icon-gb"></span></a>
<a class="dropdown-item nav-link" href="#ru"><span class="flag-icon flag-icon-ru"> </span></a>
</div>
</li>
</ul>
</div>
</nav>
Do you want something like this?
.navbar-nav {
margin: 0 auto;
}
.nav-link {
font-weight: 900;
font-size: 1rem;
}
#top-nav {
position: absolute;
z-index: 3;
width: 100%;
background-color: transparent !important;
}
#logo {
width: 100px;
height: 50px;
margin-left: 0;
padding-left: 0;
}
.flag-icon {
border-radius: 50%;
}
.navbar-light .navbar-toggler {
color: #FFFFFF;
border-color: #FFFFFF;
}
.navbar-nav {
float: right;
}
<nav class="navbar navbar-expand-lg navbar-light bg-light" id="top-nav">
<a class="navbar-brand" id="logo" href="index.html">
<img src="media/logo_light.svg" />
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<i class="fas fa-bars"></i>
</button>
<div class="collapse navbar-collapse " id="navbarNav">
<ul class="navbar-nav">
<li id="main" class="nav-item active ">
<a class="nav-link text-light" href="#">მთავარი<span class="sr-only">(current)</span></a>
</li>
<li id="about-us" class="nav-item">
<a class="nav-link text-light" href="#">ჩვენ შესახებ</a>
</li>
<li id="services" class="nav-item">
<a class="nav-link text-light" href="#">სერვისები</a>
</li>
<li id="contact" class="nav-item">
<a class="nav-link text-light " href="#">კონტაქტი</a>
</li>
<li class="nav navbar-nav nav-item dropdown justify-content-end">
<a class="nav-link dropdown-toggle" href="#" id="dropdown09" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="flag-icon flag-icon-ge"></span></a>
<div class="dropdown-menu" aria-labelledby="dropdown09">
<a class="dropdown-item nav-link" href="#gb"><span class="flag-icon flag-icon-gb"></span></a>
<a class="dropdown-item nav-link" href="#ru"><span class="flag-icon flag-icon-ru"> </span></a>
</div>
</li>
</ul>
</div>
</nav>
Try adding a class to your language switcher, navbar-right, that used to work on Bootstrap 3, not 100% sure on Bootstrap 4
Related
I used a bootstrap navbar, I created a hover effect and the problem is that when I click on a tab, the color changes in white but there is still a black margin.
Here is how it looks like:
how it is
And here is how I want it to look like:
how it should be
Here is the code:
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<a class="navbar-brand" href="#">Elegant<i class="fa fa-square"></i></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link" href="#homepage">HOMEPAGE</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">PAGE</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">FEATURE</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">PRICING</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">BLOG</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#"><i class="fa-solid fa-magnifying-glass"></i></a>
</li>
</ul>
</div>
</div>
</nav>
CSS
.nav-item a {
font-size: 12px;
color: white;
letter-spacing: 2.5px;
padding: 25px !important;
display: block;}
.nav-item a:hover {
background-color: white;
color: black;}
Make the padding of the relevant container to be 0, that is the navbar.
.nav-item a {
font-size: 12px;
color: white;
letter-spacing: 2.5px;
padding: 25px !important;
display: block;
}
.nav-item a:hover {
background-color: white;
color: black;
}
.navbar {
--bs-navbar-padding-y: 0;
padding-top: 0 !important;
padding-bottom: 0 !important;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<a class="navbar-brand" href="#">Elegant<i class="fa fa-square"></i></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link" href="#homepage">HOMEPAGE</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">PAGE</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">FEATURE</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">PRICING</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">BLOG</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#"><i class="fa-solid fa-magnifying-glass"></i></a>
</li>
</ul>
</div>
</div>
</nav>
Nav is changing site width. I don't know why's that.
I thought that's because margins or padding, but couldn't find any way to fix the problem.
I came to conclusion that is cousing problems, but I don't know why's that.
Please help!
HTML code:
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">IT SPECIALIST</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#menu" aria-controls="menu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="menu">
<ul class="navbar-nav ms-auto">
<li class="nav-item active">
<a class="nav-link" id="active" href="#">GŁÓWNA</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="nav-link" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
O NAS
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#">Zespół</a>
<a class="dropdown-item" href="#">Partnerzy</a>
<a class="dropdown-item" href="#">Facebook Fanpage</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="nav-link" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
OFERTA
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#">Odzyskiwanie Danych</a>
<a class="dropdown-item" href="#">Wsparcie dla twojej firmy</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" id="nav-link" href="#">USŁUGI DLA FIRM I OSÓB PRYWATNYCH</a>
</li>
<li class="nav-item">
<a class="nav-link" id="nav-link" href="#">DLACZEGO MY</a>
</li>
<li class="nav-item">
<a class="nav-link" id="nav-link" href="#">ZGŁOŚ AWARIĘ</a>
</li>
</ul>
</div>
</nav>
</div>
<div class="col-md-2"></div>
</div>
I deleted whole css code, and nothing changed, but in case you need it here it is:
CSS code:
body {
margin: none;
padding: none;
}
.navbar .navbar-brand {
margin-left: 1vw;
}
.navbar button {
margin-right: 1vw;
}
.navbar .dropdown-item:hover, .navbar #nav-link:hover, .navbar #active {
background-color: #5394dd;
color: white;
}
.navbar .nav-item {
margin-left: 0.5vw;
}
.navbar .nav-item:last-child {
margin-right: 1vw;
}
Edit 1:
row is cousing the problem, while using nav, without any rows, and columns, navigation is taking whole site width, nothing more.
So, is there any other way, to center site, like this?
Remove all col's from around the Navbar and add a container instead.
<div class="container">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<!--Your nav content here-->
</nav>
</div>
I'm not sure exactly how it is destroying the site's width but try this adding this to your styling:
*{
margin: 0;
padding: 0;
}
I’m trying to create a responsive navbar, and I’d like to make it transparent over the background image.
But I have little knowledge in front-end, I’ve been learning for a week.
How can I remove this white bar and leave my navbar on top of the image ?
My idea was to do something like this : https://bootstrapmade.com/demo/Restaurantly/
#background{
width: 100%;
height: 100vh;
background: url(https://image.freepik.com/fotos-gratis/pranchas-de-madeira-com-fundo-borrado-restaurante_1253-56.jpg) top center;
filter: brightness(30%);
background-size: cover; /* parallax */
background-attachment: fixed;
background-position: center;
position: relative;
padding: 0;
}
#header{
background: rgba(12, 11, 9, 0.6);
transition: all 0.5s;
z-index: 997;
top: 100px;
}
.navbar ul{
margin: 0;
padding: 0;
display: flex;
list-style: none;
align-items: center;
}
li a{
color: white;
font-size: 1.2rem;
font-family: 'Inconsolata', monospace;
font-weight: bold;
}
li a:hover{
color: #759c4d;
}
ul, li{
list-style-type: none;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-expand-lg " id="header">
<div class="container-fluid">
<a href="#" class="navbar-brand">
<img src="/Logos/logo.png" alt="">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link scrollto active" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link scrollto active" href="#produtos">Produtos</a>
</li>
<li class="nav-item">
<a class="nav-link scrollto active" href="#">Adega</a>
</li>
<li class="nav-item">
<a class="nav-link scrollto active" href="#">Hortaliça</a>
</li>
<li class="nav-item">
<a class="nav-link scrollto active" href="#">Promoções</a>
</li>
<li class="nav-item">
<a class="nav-link scrollto active" href="#">Localização</a>
</li>
<li class="nav-item">
<a class="nav-link scrollto active" href="#">Login</a>
</li>
</ul>
</div>
</div>
</nav>
<section id="background" class="d-flex align-items-center"></section>
Just remove button:
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
An example:
<nav class="navbar navbar-expand-lg " id="header">
<div class="container-fluid">
<a href="#" class="navbar-brand">
<img src="/Logos/logo.png" alt="">
</a>
<!-- <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button> -->
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link scrollto active" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link scrollto active" href="#produtos">Produtos</a>
</li>
<li class="nav-item">
<a class="nav-link scrollto active" href="#">Adega</a>
</li>
<li class="nav-item">
<a class="nav-link scrollto active" href="#">Hortaliça</a>
</li>
<li class="nav-item">
<a class="nav-link scrollto active" href="#">Promoções</a>
</li>
<li class="nav-item">
<a class="nav-link scrollto active" href="#">Localização</a>
</li>
<li class="nav-item">
<a class="nav-link scrollto active" href="#">Login</a>
</li>
</ul>
</div>
</div>
</nav>
<script src="index.js"></script>
<link rel="stylesheet" type="text/css"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js">
</script>
I have a website that I am developing utilizing the Bootstrap 4 framework. I am trying to create a navbar with the navbar-brand in the center. I was able to place the navbar-brand in the center with a navbar-nav on each side of the navbar-brand. Please find below the code that I utilized. My issue is that the navbar-brand is vertically aligned in the center of the navbar.
How can I align the navbar-brand to the bottom of the navbar and have the excess stick out at the top of the navbar without adjusting the margins?
#hdrContainer {
background-color: #0a3782;
}
.container {
background-color: inherit;
}
#tblHeader {
width: 100%;
/*font-size: .8125rem;*/
font-size: 1rem;
text-align: right;
color: #ffffff;
font-weight: bold;
}
#tblHeader tr {
height: 50px;
}
.breadcrumb {
background-color: inherit;
margin-bottom: initial;
font-weight: bold;
}
.breadcrumb .active {
color: inherit;
}
#socialbrand {
text-align: right;
}
#mainNavbar {
background-color: gray;
}
#mainNavbar .container .navbar {
position: relative;
z-index: 0;
max-height: 40px;
}
.navbar-brand {
position: relative;
z-index: 1;
margin-right: initial;
}
.form-control {
width: 200px;
}
.btn-outline-navy {
color: #f6b40e;
background-color: transparent;
background-image: none;
border-color: #f6b40e;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script>
<div id="hdrContainer" class="container-fluid">
<div class="container">
<table id="tblHeader">
<tbody>
<tr>
<td>
<nav aria-label="breadcrumb" role="navigation">
<ol class="breadcrumb">
<li class="breadcrumb-item active" aria-current="page">Commander, Naval Surface Force, US Pacific</li>
</ol>
</nav>
</td>
<td id="socialbrand" style="display: block; padding: .75rem 1rem;">Follow Us |
<i class="fa fa-facebook-square" aria-hidden="true"></i>
<i class="fa fa-twitter-square" aria-hidden="true"></i>
<i class="fa fa-flickr" aria-hidden="true"></i>
<i class="fa fa-wordpress" aria-hidden="true"></i>
<i class="fa fa-youtube-square" aria-hidden="true"></i>
</td>
</tr>
<tr>
<td colspan="2">
<nav class="navbar navbar-light">
<form class="form-inline">
<input class="form-control form-control-sm ml-auto mr-sm-2 float-right" placeholder="Search" aria-label="Search" type="search">
<button class="btn btn-sm btn-outline-navy my-2 my-sm-0" type="submit">Search</button>
</form>
</nav>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="mainNavbar" class="container-fluid">
<div class="container">
<nav class="navbar navbar-expand-lg navbar-light">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dropdown</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<!-- Just an image -->
<a class="navbar-brand mr-auto ml-auto" href="#">
<img src="https://getbootstrap.com/assets/brand/bootstrap-solid.svg" alt="" width="75" height="75">
</a>
<ul class="navbar-nav ml-auto mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown1" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dropdown</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown1">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
</div>
</nav>
</div>
</div>
The solution below makes use of the various flexbox utility classes available in Bootstrap, described in detail in the docs.
The .navbar-brand got wrapped into <div id="logo"> in order to set it's positioning to absolute, and it's bottom position to 0. That pushes down the logo container to the bottom of the navbar.
Additionally, I've added the .d-none .d-lg-block classes in order to hide the logo when the menu is collapsed.
Available as a CodePen as well.
/* Pushing logo to bottom */
#logo {
position: absolute;
bottom: 0;
}
/* Basic styling to resemble to source */
.navbar {
background-color: gray;
}
#header {
height: 100px;
color: white;
background-color: #0a3782;
display: flex;
justify-content: center;
align-items: center;
}
<div id="header">[header placeholder]</div>
<nav class="navbar navbar-expand-lg navbar-light">
<div class="container">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-around" id="navbarSupportedContent">
<div class="navbar-nav">
<a class="nav-item nav-link active" href="#">Home <span class="sr-only">(current)</span></a>
<a class="nav-item nav-link" href="#">Features</a>
<a class="nav-item nav-link" href="#">Pricing</a>
<a class="nav-item nav-link disabled" href="#">Disabled</a>
</div>
<div id="logo" class="d-none d-lg-block">
<a class="navbar-brand m-0" href="#">
<img src="http://getbootstrap.com/assets/brand/bootstrap-solid.svg" width="75" height="75" alt="">
</a>
</div>
<div class="navbar-nav">
<a class="nav-item nav-link" href="#">Item 1</a>
<a class="nav-item nav-link" href="#">Item 2</a>
<a class="nav-item nav-link" href="#">Item 3</a>
<a class="nav-item nav-link" href="#">Item 4</a>
</div>
</div>
</div>
</nav>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script>
My container elements like paragraphs, header and buttons are going under my navbar. The navbar has the property of fixed-top. I have used previous suggestions from other stackoverflow posts like this (twitter bootstrap navbar fixed top overlapping site). But nothing seems to work for me.Here is my navbar code.
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<div class="container">
<a class="navbar-brand text-white" href="#"> Bacon Bacon</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link text-white" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="#">About Us</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="#">Services</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="#">Products</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="#">Contact</a>
</li>
</ul>
</div>
</div>
</nav>
My container code
<div class="container-fluid bg-overlay">
<div class="row text-center">
<h1>Loren Inpsum</h1>
<h4>Loren Inpsum Loren Inpsum Loren Inpsum Loren Inpsum </h4>
<button type="button" class="btn btn-primary btn-lg">Get Started</button>
</div>
</div>
My CSS
#media (max-width: 979px) {
body {
padding-top: 70px;
}
}
.navbar {
margin-bottom:0px;
background: #FFFFFF;
border-color: #FFFFFF;
padding-bottom:0px;
}
.bg-overlay {
background: linear-gradient(rgba(0,0,0,.7), rgba(0,0,0,.7)), url("https://unsplash.imgix.net/photo-1416339442236-8ceb164046f8?q=75&fm=jpg&s=8eb83df8a744544977722717b1ea4d09");
background-repeat: no-repeat;
text-align:center;
background-size: cover;
background-position: center center;
color: #fff;
height: 450px;
padding-top: 0px;
}
div.container-fluid bg-overlay{
margin-bottom:30px;
}
The only thing you need to addpadding-top outside of MQ.
body {
padding-top: 60px;
}
#media (max-width: 979px) {
body {
padding-top: 70px;
}
}
.navbar {
margin-bottom:0px;
background: #FFFFFF;
border-color: #FFFFFF;
padding-bottom:0px;
}
.bg-overlay {
background: linear-gradient(rgba(0,0,0,.7), rgba(0,0,0,.7)), url("https://unsplash.imgix.net/photo-1416339442236-8ceb164046f8?q=75&fm=jpg&s=8eb83df8a744544977722717b1ea4d09");
background-repeat: no-repeat;
text-align:center;
background-size: cover;
background-position: center center;
color: #fff;
height: 450px;
padding-top: 0px;
}
div.container-fluid bg-overlay{
margin-bottom:30px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<div class="container">
<a class="navbar-brand text-white" href="#"> Bacon Bacon</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link text-white" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="#">About Us</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="#">Services</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="#">Products</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="#">Contact</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container-fluid bg-overlay">
<div class="row text-center">
<h1>Loren Inpsum</h1>
<h4>Loren Inpsum Loren Inpsum Loren Inpsum Loren Inpsum </h4>
<button type="button" class="btn btn-primary btn-lg">Get Started</button>
</div>
</div>