Removing Bottom Shadow Bootstrap Navbar - html

I am using Bootstrap's default navigation bar for my website. I would like the navbar and the content below the navbar to be the same color, without any demarcation between them. However, it appears that there is a shadow on the bottom of the navigation bar that I can't seem to get rid of.
I am using Bootstrap's default navbar template.
I have tried setting box-shadow: none; on each of the navbar classes I suspect (from inspecting the elements) may be causing this (.navbar, .navbar-default, and .container-fluid) to no avail.
nav {
box-shadow: none;
}
.navbar {
.container-fluid {
box-shadow: none;
}
box-shadow: none;
}
.navbar .navbar-collapse {
box-shadow: none;
}
.navbar .navbar-nav {
box-shadow: none;
}
.navbar-default {
box-shadow: none;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css">
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse"
data-target=".navbar-collapse" aria-expanded="false">
<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="#">LOGO-GOES-HERE</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li>LINK</li>
<li>LINK</li>
<li>LINK</li>
<li>LINK</li>
<li>LINK</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
I have also looked at Bootstrap's CSS and could not locate where the box-shadow is coming from.
Does anyone know any CSS I could write to remove this shadow from the bottom of the navigation bar, so that there is no line separating the navbar from the rest of the content?
Thank you so much for your time in advance.

This code is enough:
.navbar-default {
box-shadow: none;
}
But make sure that the code is placed after the link to bootstrap-theme.min.css. Otherwise your changes will not work.
#import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css');
#import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css');
.navbar-default {
box-shadow: none;
}
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse"
data-target=".navbar-collapse" aria-expanded="false">
<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="#">LOGO-GOES-HERE</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li>LINK</li>
<li>LINK</li>
<li>LINK</li>
<li>LINK</li>
<li>LINK</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>

You can try this link, it works. There is a shadow in the border.
https://getbootstrap.com/docs/4.3/utilities/shadows/
I tried like this, without any css as the solutions above. Just insert "shadow-none" as Documented.
<nav class="shadow-none navbar navbar-expand-sm ">
</nav>

Dont think there is a box shadow on the bootstrap navbar but there is a border have you tried
.navbar-default{
border:none;
}

You need to make sure that CSS commands are compatible with the browser. The browser compatibility description is given below.
The -moz-appearance CSS property is used in Gecko (Firefox) to display an element using platform-native styling based on the operating system's theme.
The -webkit-appearance property is used by WebKit-based (e.g., Safari) and Blink-based (e.g., Chrome, Opera) browsers to achieve the same thing. Note that Firefox and Edge also support -webkit-appearance, for compatibility reasons.
.navbar{
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}

just add "shadow-none" class in the nav element

this one solved my problem.
.navbar-default {
background:none;
box-shadow: none;
}

If you just want to remove box-shadow from mdb-navbar do the following,
Inside your style.scss file in angular project paste the following code .navbar{ box-shadow: none!important; }

Related

Bootstrap responsive navbar with toggle-navigation

I'm looking for creating a new project Template in order to convert Wordpress Template to Bootstrap Template.
I'm working on navbar and I'm getting an issue with responsive-design and toggle-navigation
When I'm in laptop device, my navbar is well-defined as I want. But, with smartphone device for example, the toggle-navigation doesn't display my navbar as I would like to get. Especially with navbar-left and navbar-right.
Laptop device :
Smartphone device :
I would like to get in smartphone view all elements aligned vertically and it's not the case for www.coe.int and languages with glyphicons
This is my HTML script :
<nav class="navbar navbar-default navbar-static-top">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collection of nav links and other content for toggling -->
<div id="navbarCollapse" class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-left">
<li><a id="coe" href="http://www.coe.int">WWW.COE.INT</a></li>
</ul>
<ul class="nav navbar-nav navbar-middle">
<li><a class="active" href="#">EUROPEAN PHARMACOPOEIA</a></li>
<li>PHARMEUROPA</li>
<li>OTHER PUBLICATIONS</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>Languages</li>
<li><a><span class="glyphicon glyphicon-search"></span></a></li>
</ul>
</div>
</div>
</nav>
And my CSS part :
body {
font-family:sans-serif;
font-size: 1.25em;
}
/* ######################## */
/* HEADER PART */
/* ######################## */
header{
background-color: #e8e8e8;
}
header a{
color: #a5a5a4;
}
/* Bootstrap Stuff */
nav.navbar.navbar-default.navbar-static-top {
background-color: #e8e8e8;
}
.navbar .navbar-nav {
display: inline-block;
float: none;
vertical-align: top;
}
.navbar .navbar-collapse {
text-align: center;
}
a#coe {
font-weight: bold;
text-decoration: none;
}
ul.nav.navbar-nav.navbar-middle > li > a:hover {
background-color: #1b7eac;
color: black;
transition: all 0.2s;
}
ul.nav.navbar-nav.navbar-middle > li > a:focus{
background-color: #1b7eac;
color: white;
transition: all 0.2s;
}
Could you help me to find a solution ?
My reputation does not allow me to comment unfortunately as this certainly be a comment.
But have you tried simply altering the text size using media queries to get your desired result?
--EDIT-----
I am assuming you already have the toggle button already working.
In which case If you wish to align them vertically you can use the bootstrap operator
col-sm-4 (for three items vertically aligned)
col-sm-3 (for 4 items vertically aligned)
Which will give each element their own space and align them vertically.
But remember you need to have a container then row then this property like so:
<div class="container">
<div class="row">
<div class="col-sm-4">item here</div>
<div class="col-sm-4">item here</div>
<div class="col-sm-4">item here</div>
</div>
</div>
I hope this helps you!

Why doesn't the bootstrap navbar mobile menu appear?

I have two questions. The first and the most important is how to make the menu in the minified version to appear. And the second thing I want is for the navbar to stay on the top when I scroll down and to turn black from transparent that it is now.
The Code is:
<nav class="navbar-inner navbar-inverse">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<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="#">Cosmos</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav pull-right">
<li>Home</li>
<li>About</li>
<li>Portfolio</li>
<li>Contact</li>
</ul>
</div>
</div>
</nav>
and the css is:
.navbar-inner {
background: transparent;
position: absolute;
top: 0;
right: 0;
left: 0;
z-index: 1;
}
You can also check the codepen page of the project:
https://codepen.io/georgekech/pen/ZLNMGE
Answer to both your questions:
While using bootstrap responsiveness is already handled. If provided the right markup on your HTML, bootstrap will take care of the menu on mobile view. Hence when you resize down to the mobile view, there would be a "hamburger menu" on the right of your navbar which toggles your menu options.
Next, If you want your header to stay on the top when you scroll down. Bootstrap already provides it. You just have to replace the class navbar-inverse with navbar-fixed-top on your <nav>. Also importantly remove the unnecessary position: absolute properties given to the navbar-inner
.navbar-inner {
background: transparent;
position: absolute; //remove
top: 0; //remove
right: 0; //remove
left: 0; //remove
z-index: 1;
}
Next, to change the background of the navbar when you scroll you need to add 2 simple changes, one to your JavaScript(using JQuery) another to your CSS, these 2 changes going hand in hand.
JQuery:
$(function () {
$(document).scroll(function () {
var $nav = $(".navbar-fixed-top");
$nav.toggleClass('scrolled', $(this).scrollTop() > $nav.height());
});
});
CSS:
.navbar-fixed-top.scrolled {
background: black;
}
The Jquery will basically add/remove(toggle) a class to your navbar when you scroll more than the height of the navbar. Ofcourse the CSS is to just add the background color when the class is added from the JQuery.
Your codepen here
Note:
Obviously don't forget to include the JQuery library for the JavaScript to work, alternatively you can do the same using plain JavaScript.
If you do include JQuery, since you're using Bootstrap v3.3.6, JQuery version needs to be higher than 1.9.1 but also lower than 3. All of which you can find here
Done deal !
Try Following Code
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!-- Bootstrap Navigation Start -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<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="#">Cosmos</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<div>
<ul id="menu-hover" class="nav navbar-nav">
<li>Home</li>
<li>Public Service</li>
<li>Idea SubMission</li>
<li>Power Division</li>
</ul>
</div>
</div>
</div> <!-- End Navbar Collapse -->
</nav>
<!--End Bootstrap Navigation
.navbar-inner {
background: transparent;
position: absolute;
top: 0;
right: 0;
left: 0;
z-index: 1;
}
.navbar-inner position fixed will make your menu stable even if you will scroll down.
To change menu color on scroll, please check this answer of this menu background change color on scroll.
You need to use the same name used as the data-target in the button as the id of the div for the menu. In this case, it is "bs-example-navbar-collapse-1"
So add id="bs-example-navbar-collapse-1 to the div class="collapse navbar-collapse"
For the navbar, you don't need to use CSS if you are using bootstrap for what you want. Add the class of "navbar-fixed-top" to the nav element.
When you do use this class, you will need to add body {padding-bottom: 70px; }. This will push the content of your page to be under your navbar. 70px works with your example but change it as you see fit.

Bootstrap Navbar Collapse not working when navbar position is absolute

When using position: absolute; the navbar collapse does not work properly. When expanding the menu, the other content is not moved down anymore. Also, the button to expand and collapse is not visible (which is why I have made it gray) and does not appear in the correct position.
HTML code for the navbar:
<nav class="bootstrap-iso navbar navbar-default navbar-absolute">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="bootstrap-iso navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<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="#">DEMO</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 navbar-right" id="navbar-right">
<li>Home</li>
<li>Bruid</li>
<li>Bruidegom</li>
<li>De Winkel</li>
<li>Blog</li>
<li>Contact</li>
<li><button class="btn" id="afspraak">AFSPRAAK MAKEN</button></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
CSS:
navbar-right li {
font-family: Arial;
text-transform: uppercase;
font-weight: bold;
}
#afspraak {
margin-top: 5%;
background-color: #f5758e;
font-family: Arial;
text-transform: uppercase;
font-weight: bold;
color: white;
}
#navbar-right a {
color: white;
}
.navbar-default .navbar-brand {
color: white !important;
font-size: 36px !important;
}
.navbar-default {
background: transparent !important;
border: none !important;
position: absolute;
}
.navbar-toggle {
background-color: grey !important;
}
Many thanks in advance for your help!
YoungStarDC it happens to the best of us...check the first line of the navbar class. You need to add a '<' everything that's open has to be closed and everything that's closed has to be opened. The button will appear when you change the browsers window size once you do that.
<nav class="bootstrap-iso navbar navbar-default navbar-absolute"></nav>
P.S. Bootstraps navbar-collapse only collapses the navbar and shows the button when the screen is too small to hold the navbar

Bootstrap toggable menu icon doesn't work on small device

i added at my hoe page a navbar with toggable icon on small screen; It is the typical navbar of bootstrap.
I have the problem that when i go on developer tool and resize the screen in order to test the responsive part, happen that the icon doesn't toggle, it is like is not active.
Any help?
Here is the code:
<nav id="header" class="navbar navbar-default">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navmenu" aria-expanded="false" aria-controls="navmenu">
<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="#"><img id="logo" src="images/art-of-hair.png"></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div id="navmenu" class="collapse navbar-collapse navbar-right">
<ul class="nav navbar-nav">
<li class="active">Home<span class="sr-only">Home</span></li>
<li>Hair Styles</li>
<li class="">About</li>
<li class="">Contact</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
and css:
* {
margin: 0;
}
body {
font-family: 'Alice', serif;
}
#header {
height:200px;
}
#logo {
width: 300px;
height:150px;
}
#navmenu {
margin:30px 120px 0 0;
}
In case of toggle, I guess you also need some jQuery to make the toggle function.
Maybe try something like this:
<script>
$("button").click(function(){
$("#navmenu").slideToggle();
});
</script>

removing floats from bootstrap navbar without affecting layout

hey guys i am basically new to css and trying to build a bootstrap navbar ,the issue is that i had to center certain contents of the navbar I.E , center the menu items .
basically after going through the source of the bootstrap navbar i figured out that the reason all elements in the navbar appear in one line rather then moving on to the next line is because the elements in the navbar are floated either right or left , the movement you remove the floats the alignment is broken ,
so what i tried to do is : - HTML code(TYPICAL bootstrap markup) :
<nav role="navigation" class="navbar navbar-default navbar-fixed">
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- Brand -->
</div>
<!-- Collection of nav links and other content for toggling -->
<div id="navbarCollapse" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>Profile</li>
<li>Messages</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><img src="http://images.dailyo.in/images/facebook_two.png" alt=""></li>
</ul>
</div>
</div>
</nav>
And the CSS(customized css) :
.navbar-default .navbar-collapse ul.navbar-nav{
text-align: center;
float: none;
width: 300px;
}
.navbar-default .navbar-collapse ul.navbar-nav li {
float: none;
display: inline-block;
}
.brand-holder {
height: 200px;
background: #000;
}
.navbar-fixed {
position: fixed;
width: 100%;
}
The thing to notice is see how i have removed the floats in ul.navbar-nav and ul.navbar-nav li
Fiddle here . , now see how the contents of
<ul class="nav navbar-nav navbar-right">
<li><img src="http://images.dailyo.in/images/facebook_two.png" alt=""></li>
</ul>
is floated to the next line . is there anyway that i can have the contents back inline with the menu items ?
P.S. :: i would really like to avoid using absolute positioning .
Thank you.
Alex-z.
If my understanding of your question is correct, probably by changing the CSS as below
.navbar-default .navbar-collapse ul.navbar-nav{
text-align: center;
float: none;
text-align:left;
and instead of keeping an another UL for the FB Logo keep the whole Li as in the first Ul itself and aligning to right, should help
so the final html will be
<nav role="navigation" class="navbar navbar-default navbar-fixed">
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- Brand --> <!-- </div>-->
<!-- Collection of nav links and other content for toggling -->
<div id="navbarCollapse" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>Profile</li>
<li>Messages</li>
<li style="float:right"><img src="http://images.dailyo.in/images/facebook_two.png" alt=""></li>
</ul>
</div>
</div>
You can have a check on the result fiddle
Hope this helps.
Thanks,
Philemon