These are probably really simple questions, but it has me a bit stumped the CSS;
How can i make the green background (on a nav-item hover) take up the full height of the navbar?
Additionally, when the navbar is collapsed (for small/mobile screens) how can i center the nav-item text & add a border-bottom for the nav-item?
Here's my HTML
<nav class="js-navbar-scroll navbar navbar-expand-lg navbar-light fixed-top navbar-custom">
<div class="container-fluid">
<a class="navbar-brand" href="/">
<img src="img/logo-design-new.png" alt="JDC Support" style="width: 40px;" />
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarToggler">
<ul class="navbar-nav ml-auto mt-2 mt-lg-0">
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="about">About</a>
</li>
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="photos">Photos</a>
</li>
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="collections">Collections</a>
</li>
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="careers">Careers</a>
</li>
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="contact">Contact</a>
</li>
</ul>
</div>
</div>
</nav>
Here's my CSS:
.navbar-custom {
background-color: #fff !important;
border-bottom: 2px solid #f1f1f1 !important;
}
.navbar-custom .container-fluid .nav-item.active .nav-link,
.navbar-custom .container-fluid .nav-item:hover .nav-link {
color: #ffffff;
background-color: green;
}
And here's a Plunker of it;
Bootstrap Navbar
First of all you need to add jquery before bootstrap js and add this custom css for what you want
/* Styles go here */
.navbar-custom {
background-color: #fff !important;
border-bottom: 2px solid #f1f1f1 !important;
}
/* change the color of active or hovered links */
.navbar-custom .container-fluid .nav-item.active .nav-link,
.navbar-custom .container-fluid .nav-item:hover .nav-link {
color: #ffffff;
background-color: green; /* add background-color to active links */
}
<link data-require="bootstrap#4.1.3" data-semver="4.1.3" rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" />
<script data-require="jquery#3.2.1" data-semver="3.2.1" src="https://cdn.jsdelivr.net/npm/jquery#3.2.1/dist/jquery.min.js"></script>
<script data-require="bootstrap#4.1.3" data-semver="4.1.3" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<style type="text/css">
.navbar-custom{
padding-top:0rem;
padding-bottom:0rem;
}
.nav-link {
display: block;
padding: 1rem 1rem;
}
#media (max-width: 991px){
.navbar-custom{
padding-top:0.5rem;
padding-bottom:0.5rem;
}
.nav-link {
display: block;
padding: 0.5rem 1rem;
}
.navbar-light .navbar-nav .nav-link {
text-align:center;
}
.navbar-light .navbar-nav .nav-item {
border-bottom:5px solid #000000;
}
}
</style>
<nav class="js-navbar-scroll navbar navbar-expand-lg navbar-light fixed-top navbar-custom">
<div class="container-fluid">
<a class="navbar-brand" href="/">
<img src="img/logo-design-new.png" alt="JDC Support" style="width: 40px;" />
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarToggler">
<ul class="navbar-nav ml-auto mt-2 mt-lg-0">
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="about">About</a>
</li>
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="photos">Photos</a>
</li>
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="collections">Collections</a>
</li>
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="careers">Careers</a>
</li>
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="contact">Contact</a>
</li>
</ul>
</div>
</div>
</nav>
You can used below code for nav-item hover and text-center nad boredr-bottom for small/mobile screens.
.nav-item:hover{
background-color:green;
}
.collapse.show{
text-align:center;
}
.collapse.show .nav-item{
border-bottom:1px solid black;
}
Please show this link for that. https://jsfiddle.net/DharaSumitPatel/8h1cwezq/
Try changing your css with this
<style>
.navbar-custom {
background-color: #fff !important;
border-bottom: 2px solid #f1f1f1 !important;
padding:0px;
margin:0px;
}
.navbar-custom .container-fluid .nav-item.active .nav-link,
.navbar-custom .container-fluid .nav-item:hover .nav-link {
color: #ffffff;
background-color: green;
border:2px solid green;
}
#navbarToggler.show{
text-align:center;
}
#navbarToggler.show
.nav-item{
border-bottom:1px solid gray;
}
</style>
<nav class="js-navbar-scroll navbar navbar-expand-lg navbar-light fixed-top navbar-custom">
<div class="container-fluid">
<a class="navbar-brand" href="/">
<img src="img/logo-design-new.png" alt="JDC Support" style="width: 40px;" />
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarToggler">
<ul class="navbar-nav ml-auto mt-2 mt-lg-0">
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="about">About</a>
</li>
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="photos">Photos</a>
</li>
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="collections">Collections</a>
</li>
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="careers">Careers</a>
</li>
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="contact">Contact</a>
</li>
</ul>
</div>
</div>
</nav>
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>
Using bootstrap's navbar, I'm only using the dropdown toggler icon on the right. I want a background with a width that covers only the right portion and not the entire width. Any insight would be appreciated.
Attempts 1 and 2:
Trying to get:
.menu {
font-family: header;
color: white !important;
font-size: 3rem;
background-color: rgba(0, 0, 0, 0.3);
}
.menu-bg {
background-color: rgba(0, 0, 0, 0.3);
}
body {
background: #333 !important;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<nav class="navbar navbar-dark fixed-top pt-md-5 pe-md-5 pt-2 pe-2">
<div class="container-fluid">
<button class="navbar-toggler ms-auto custom-toggler menu collapsed" 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> MENU
</button>
<div class="collapse navbar-collapse menu-items" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto mb-2 mb-lg-0 menu-bg">
<li class="nav-item ms-auto">
<a class="nav-link pe-3" href="#features">FEATURES</a>
</li>
<li class="nav-item ms-auto">
<a class="nav-link pe-3" href="#counter">SHARK COUNTER</a>
</li>
<li class="nav-item ms-auto">
<a class="nav-link pe-3" href="#about">ABOUT US</a>
</li>
<li class="nav-item ms-auto">
<a class="nav-link pe-3" href="#faq">FAQ</a>
</li>
<li class="nav-item ms-auto">
<a class="nav-link pe-3 rounded-bottom" href="#">BACK TO TOP</a>
</li>
</ul>
</div>
</div>
</nav>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
Kindly try
.menu-bg {
width: 250px;
}
Here is a working example. The gist is to use position:absolute and set width to dropdown so that it will stick to the right.
.menu {
font-family: header;
color: white !important;
font-size: 3rem;
background-color: rgba(0, 0, 0, 0.3);
}
.menu-bg {
background-color: rgba(0, 0, 0, 0.3);
}
#navbarSupportedContent {
width:150px;
position: absolute;
right:0px;
top:100%;
}
.dropdown-wrap {
position: relative;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<nav class="navbar navbar-dark fixed-top pt-md-5 pe-md-5 pt-2 pe-2">
<div class="container-fluid">
<div class="row">
<div class="col-xs-10"></div>
<div class="col-xs-2 dropdown-wrap">
<button class="navbar-toggler ms-auto custom-toggler menu collapsed" 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> MENU
</button>
<div class="collapse navbar-collapse menu-items" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto mb-2 mb-lg-0 menu-bg">
<li class="nav-item ms-auto">
<a class="nav-link pe-3" href="#features">FEATURES</a>
</li>
<li class="nav-item ms-auto">
<a class="nav-link pe-3" href="#counter">SHARK COUNTER</a>
</li>
<li class="nav-item ms-auto">
<a class="nav-link pe-3" href="#about">ABOUT US</a>
</li>
<li class="nav-item ms-auto">
<a class="nav-link pe-3" href="#faq">FAQ</a>
</li>
<li class="nav-item ms-auto">
<a class="nav-link pe-3 rounded-bottom" href="#">BACK TO TOP</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</nav>
Working JSfiddle
Only:
.menu-bg {
background-color: rgba(0, 0, 0, 0.3);
display: inline-block;
}
.nav-d a{
display: block;
color: black;
text-decoration: none;
border-bottom: 3px solid transparent;
}
.nav-d a:hover {
border-bottom: 3px solid #262262;
}
.nav-d a.active {
border-bottom: 3px solid #262262;
}
<div class="container nav-d" style="max-width: 1134px;">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand mr-5" href="home.html"><img src="Logo-transparant.png" alt="Logo-transparant"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<li class="nav-item active pr-4">
<a class="nav-link" href="home.html" > Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item pr-4">
<a class="nav-link" href="Nieuwefietsen.html">Nieuwe fietsen</a>
</li>
<li class="nav-item pr-4">
<a class="nav-link" href="Tweedehandsfietsen.html">Tweedehands fietsen</a>
</li>
<li class="nav-item pr-5">
<a class="nav-link" href="Fietsreperatie.html">Fietsreperatie</a>
</li>
<li class="nav-item pr-4">
<a class="nav-link" href="Contact.html">Contact</a>
</li>
<li class="nav-itme pr-0" style= "border:2px solid rgb(47, 47, 112); border-radius: 250px; background-color: rgb(47, 47, 112);">
<a class="nav-link my-link disabled ml-3 mr-2 " herf="home.html" style="color:white; font-size: 16px;"><i class="far fa-phone mr-2"></i>06 20453640</a>
</li>
</nav>
</div>
Disable link decoration on the logo (the bottom underline decoration). i want to get rid of it i tried text-decoration: none; that didn't help.
Try this instead
You HTML Code is invalid there is not <ul> tag before <li>
.nav-d a.navbar-brand:hover{
border-bottom-color:transparent;
}
.nav-d a{
display: block;
color: black;
text-decoration: none;
border-bottom: 3px solid transparent;
}
.nav-d a:hover {
border-bottom: 3px solid #262262;
}
.nav-d a.active {
border-bottom: 3px solid #262262;
}
.nav-d a.navbar-brand:hover{
border-bottom-color:transparent;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<div class="container nav-d" style="max-width: 1134px;">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand mr-5" href="home.html"><img src="Logo-transparant.png" alt="Logo-transparant"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<ul class="navbar-nav">
<li class="nav-item active pr-4">
<a class="nav-link" href="home.html" > Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item pr-4">
<a class="nav-link" href="Nieuwefietsen.html">Nieuwe fietsen</a>
</li>
<li class="nav-item pr-4">
<a class="nav-link" href="Tweedehandsfietsen.html">Tweedehands fietsen</a>
</li>
<li class="nav-item pr-5">
<a class="nav-link" href="Fietsreperatie.html">Fietsreperatie</a>
</li>
<li class="nav-item pr-4">
<a class="nav-link" href="Contact.html">Contact</a>
</li>
<li class="nav-itme pr-0" style= "border:2px solid rgb(47, 47, 112); border-radius: 250px; background-color: rgb(47, 47, 112);">
<a class="nav-link my-link disabled ml-3 mr-2 " herf="home.html" style="color:white; font-size: 16px;"><i class="far fa-phone mr-2"></i>06 20453640</a>
</li>
</ul>
<div>
</nav>
</div>
Do something like this:
a {
color:inherit;
text-decoration: none;
}
Try This. That's it.
.nav-d a.navbar-brand:hover{border-bottom:none;}
I've made some changes to some buttons and now my navbar items get bigger on hover, which is a behaviour not desired.
This behaviour is more noticable when hovering on the logo in the navbar.
Codepen:
https://codepen.io/anon/pen/jjEMZj
<nav class="navbar navbar-expand-md navbar-dark fixed-top navbar-bg">
<a class="navbar-brand" href="/"> <img src="https://stickers-gallito-uploaded-files.s3.amazonaws.com/static/img/stickers_gallito_logo.png" width="20px" height="30px"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse"
aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="/stickers">Stickers <span class="sr-only">(current)</span></a>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="/carrito_de_compras/"><i class="fas fa-shopping-cart"
style="color:white !important;"></i> ( 3)</a>
</li>
<li class="nav-item active">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false"><i class="fas fa-user-circle"></i> ogonzales</a>
<div class="dropdown-menu dropdown-menu-right">
Historial de compras
</div>
</li>
<li class="nav-item active">
<a class="nav-link" href="/salir/">Salir <i class="fas fa-sign-out-alt"></i></a>
</li>
</ul>
</div>
</nav>
This is because of the footer.css Line #38:
li.footer_nav_links a:focus, a:hover {
font-size: 12px;
color: rgb(2, 214, 158);
text-decoration: none;
}
Get rid of the font-size: 12px there and it would be fine. Maybe, you are using a:hover in a generic way, so it affects all the <a> tags when hovered. Did you mean li.footer_nav_links a:hover?
li.footer_nav_links a:focus, li.footer_nav_links a:hover {
font-size: 12px;
color: rgb(2, 214, 158);
text-decoration: none;
}
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>