Style Dropdown Menu on second Bootstrap Navbar - css

I've styled the main navbar on my homepage to match the design of that page, but I have other pages that need to have different font colors, hover, etc. on their own pages. I added the class .navbar-gallery to the <nav> which allowed me to style the background color of the whole navbar, but I now need to change the colors of the font on the dropdown menu. My problem is that I can't seem to target just the .navbar ul.navbar-right li.dropdown ul.dropdown-menu li a on this specific navbar. I tried adding a class .gallerydropdown to the ul.dropdown-menu, but the browser ignores it. I'm sure there's a fairly easy answer that I'm missing.
Here is my full navbar:
<nav class="navbar-gallery 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="#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-gallery" href="index.html">ReFace It</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">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Galleries<span class="caret"></span>
</a>
<ul class="dropdown-menu gallerydropdown">
<li class="gallery">Stone</li>
<li>Brick</li>
<li>Stucco</li>
<li>Stone/Stucco</li>
<li>Brick/Stucco</li>
</ul>
</li>
<li>Get In Touch</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
So I'm trying to target the CSS of this section:
<ul class="dropdown-menu gallerydropdown">
<li class="gallery">Stone</li>
<li>Brick</li>
<li>Stucco</li>
<li>Stone/Stucco</li>
<li>Brick/Stucco</li>
</ul>
Here is my CSS:
.navbar {
margin-bottom: 50px;
font-family: "Open Sans", "Helvetica Neue", Arial, sans-serif;
color: #FFFFFF;
background: transparent;
border: none; }
.navbar .navbar-header a.navbar-brand {
color: #FFFFFF;
font-weight: 500;
font-size: 1rem;
text-transform: uppercase; }
.navbar ul.navbar-right {
padding-right: 20px; }
.navbar ul.navbar-right li a {
color: #FFFFFF;
font-family: "Open Sans", "Helvetica Neue", Arial, sans-serif;
text-transform: uppercase;
font-weight: 500; }
.navbar ul.navbar-right li a:hover {
color: #cccccc; }
.navbar ul.navbar-right li a:visited {
color: #FFFFFF; }
.navbar ul.navbar-right li a.sm-button {
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
-o-appearance: none;
appearance: none;
border: none;
padding: .3em 1.1em;
margin-top: 0.6rem;
background-color: #f42e4e;
color: #ffffff;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: "PT Sans", sans-serif;
font-size: 1rem;
font-weight: bold;
cursor: pointer;
-webkit-border-radius: 180px;
-moz-border-radius: 180px;
-ms-border-radius: 180px;
border-radius: 180px;
max-width: 150px;
text-align: center; }
#media (min-width: 768px) {
.navbar ul.navbar-right li a.sm-button {
max-width: 175px; } }
.navbar ul.navbar-right li a.sm-button:hover {
background-color: #dc2946; }
.navbar ul.navbar-right li.dropdown {
background: transparent; }
.navbar-default .navbar-nav > .open > a, .navbar-default .navbar-nav > .open > a:focus, .navbar-default .navbar-nav > .open > a:hover {
background-color: transparent;
color: #FFFFFF; }
.dropdown-menu {
background-color: #FFFFFF;
padding: 0; }
.navbar ul.navbar-right li.dropdown ul.dropdown-menu li a {
color: #3C3C3E; }
.navbar ul.navbar-right li.dropdown ul.dropdown-menu li a:visited {
color: #3C3C3E; }
.navbar ul.navbar-right li.dropdown ul.dropdown-menu li a:hover {
background-color: #cccccc; }
.navbar-default .navbar-toggle .icon-bar {
background-color: #ddd; }
.navbar-default .navbar-toggle:hover {
background-color: transparent; }
.navbar-gallery {
background: #3C3C3E;
-webkit-border-radius: 0;
-moz-border-radius: 0;
-ms-border-radius: 0;
border-radius: 0; }
.navbar-gallery .navbar-header a.navbar-brand-gallery {
color: #FFFFFF;
font-weight: 500;
font-size: 1.5rem;
text-transform: uppercase;
float: left;
padding: 15px 15px; }
.navbar-gallery .navbar-header a.navbar-brand-gallery:hover {
text-decoration: none; }
.navbar-gallery .navbar-default .navbar-nav > .open > a, .navbar-gallery .navbar-default .navbar-nav > .open > a:focus, .navbar-gallery .navbar-default .navbar-nav > .open > a:hover {
background-color: #3C3C3E;
color: #FFFFFF; }
.navbar-gallery .dropdown-menu {
background-color: #3C3C3E;
padding: 0; }
.navbar-gallery .dropdown-menu li.gallery a, .navbar-gallery .dropdown-menu li.gallery a:visited {
color: #FFFFFF; }

This is the CSS selector your looking for:
.navbar-gallery .dropdown-menu > li > a {
color: royalblue;
}
Demo JSFiddle.
Update
If you're looking for a per page override you could add a class to the <body> tag foreach page and do the following:
<body class="about">
<!-- or -->
<body class="contact">
.about .navbar ul.navbar-right li.dropdown ul.dropdown-menu li a {
color: green;
}
.contact .navbar ul.navbar-right li.dropdown ul.dropdown-menu li a {
color: green;
}

Related

Stop Bootstrap 3 hamburger menu dropdowns from displaying on hover

When hovering dropdown items in the hamburger menu, their contents are shown like this:
I'd like to disable this behavior on hover, so they are only shown when the dropdown is clicked.
Tried this, no luck.
#media only screen and (min-width: 768px) {
li.dropdown:hover > ul {
display: none;
}
}
.navbar {
border: none;
}
.dropdown-menu {
background-color: #f5f5f5;
}
.navbar-header {
background-color: #3a7dbb;
}
.collapse.navbar-collapse.js-navbar-collapse {
background-color: #3a7dbb;
}
.navbar-default .navbar-nav > li > a.dropdown-toggle {
font-family: "Oswald",Helvetica,Arial,sans-serif;
font-size: 18px;
color: white;
}
.dropdown > .dropdown-menu > li > a {
font-size: 16px;
}
.glyphicon-shopping-cart:before {
color: white;
}
.navbar .navbar-brand {
padding-top: 0px;
}
.navbar .navbar-brand > img{
height: 100%;
}
.dropdown > .dropdown-menu > li > a:hover {
background-color: white;
}
.navbar-nav > li > .dropdown-menu {
background-color: #f5f5f5;
margin-top: 20px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.navbar-default .navbar-nav > li > a {
/* width: 8em; */
font-weight: bold;
}
.mega-dropdown {
position: static !important;
width: 100%;
}
.mega-dropdown-menu {
padding: 20px 0px;
width: 100%;
box-shadow: none;
-webkit-box-shadow: none;
}
.center {
margin: auto;
}
.mega-dropdown-menu > li > ul {
padding: 0;
margin: 0;
}
.mega-dropdown-menu > li > ul > li {
list-style: none;
}
.mega-dropdown-menu > li > ul > li > a {
display: block;
padding: 3px 20px;
clear: both;
font-weight: normal;
line-height: 1.428571429;
color: #262626;
white-space: normal;
}
.mega-dropdown-menu > li ul > li > a {
font-size: 16px;
}
.mega-dropdown-menu > li ul > li > a:hover,
.mega-dropdown-menu > li ul > li > a:focus {
text-decoration: none;
color: #444;
background-color: white;
}
li.dropdown:hover {
background-color: #c3c1c1;
}
ul.dropdown-menu.mega-dropdown-menu.row {
width: 80%;
left: 0;
right: 0;
margin: 0 auto; /* Centers the element */
}
.mega-dropdown-menu .dropdown-header {
color: #428bca;
font-size: 18px;
font-weight: bold;
}
.mega-dropdown-menu .dropdown-header > a {
color: #428bca;
font-size: 18px;
font-weight: bold;
padding-left: 0;
}
.mega-dropdown-menu form {
margin: 3px 20px;
}
.mega-dropdown-menu .form-group {
margin-bottom: 3px;
}
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
color: black !important;
}
/* .mega-dropdown-menu:before {
content: "";
border-bottom: 15px solid #fff;
border-right: 17px solid transparent;
border-left: 17px solid transparent;
position: absolute;
top: -15px;
left: 285px;
z-index: 10;
}
.mega-dropdown-menu:after {
content: "";
border-bottom: 17px solid #ccc;
border-right: 19px solid transparent;
border-left: 19px solid transparent;
position: absolute;
top: -17px;
left: 283px;
z-index: 8;
} */
.dropdown:hover .dropdown-menu {
display: block;
margin-top: 0; // remove the gap so it doesnt close
}
#main_pnlSiteTemplateHeader {
background-color: white;
padding-left: 0px;
padding-right: 0px;
}
#main_content_Content {
padding-top: 80px;
}
#main_content_TopBanner {
padding-top: 80px;
}
ul.dropdown-menu.mega-dropdown-menu.row {
top: 49px;
}
#media only screen and (min-width: 768px) {
.dropdown:hover > .dropdown-menu {
display: block;
}
.dropdown > .dropdown-toggle:active {
pointer-events: none;
}
}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Oswald|Open+Sans:400,400italic,600italic,600">
<!------ Include the above in your HEAD tag ---------->
<div class="">
<nav class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".js-navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse js-navbar-collapse">
<ul class="nav navbar-nav">
<li class="dropdown mega-dropdown">
About<span class="caret"></span>
<ul class="dropdown-menu mega-dropdown-menu row">
<li class="col-sm-4">
<ul>
<li class="dropdown-header">Business Relationship Management</li>
<li>Capability</li>
<li>Role</li>
</ul>
</li>
<li class="col-sm-4">
</li>
<li class="col-sm-4">
</li>
</ul>
</li>
</ul>
</div>
</nav>
</div>
please try below css:
<style>
.dropdown:hover > .dropdown-menu {
display: none;
}
.navbar-default .navbar-nav > li > a:focus + ul.dropdown-menu {
display: block;
top: auto;
width: 100%;
margin-top: 7px;
}
</style>

Scroll in navbar menu fixed

I have this code (this is bootstrap fixed navbar menu):
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid container_mop">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#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>
</div>
<a class="navbar-brand" href="#"><img src="images/logo.png" class="center img-responsive logo_top"></a>
<div class="collapse navbar-collapse" id="navbar-collapse-1">
<ul class="nav navbar-nav navbar-left navbar_odstep">
<li class="mopy_menu_1">O mnie</li>
<li class=" mopy_menu_1 dropdown ">
gabinet <span class="caret"></span>
<ul class="dropdown-menu dropdownPadding">
<li class=" mopy_menu_dropdown">- Gdzie przyjmuje </li>
<li class=" mopy_menu_dropdown">- Badania </li>
<li class=" mopy_menu_dropdown">- Zabiegi</li>
<li class=" mopy_menu_dropdown">- Przygotowanie </li>
</ul>
</li>
<li class="mopy_menu_1">Usługi</li>
<li class="mopy_menu_1">Cennik</li>
<li class="mopy_menu_1">Artykuły</li>
</ul>
<ul class="nav navbar-nav navbar-right navbar_odstep">
<li class="mopy_menu_1">Kontakt</li>
</ul>
</div>
</div>
</nav>
.navbar_odstep {
padding-top: 50px;
padding-bottom: 40px;
}
/*menu top*/
.navbar-default .navbar-nav > li > a {
color: white;
}
.navbar-default .navbar-nav > li > a:hover {
color: white;
}
.navbar-default .navbar-nav > li > a:focus {
color: white;
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .open > a:focus,
.navbar-default .navbar-nav > .open > a:hover {
background-color: transparent !important;
color: white !important;
}
.navbar-default .navbar-nav .open .dropdown-menu > li > a:focus,
.navbar-default .navbar-nav .open .dropdown-menu > li > a:hover {
background-color: #4B617F !important;
color: white !important;
}
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
background-color: #4B617F !important;
color: white !important;
}
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-color: #3C4052;
}
.dropdown-menu {
background-color: #4B617F !important;
}
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-color: #3C4052;
}
.navbar-default {
background-color: #3C4052;
border-color: #3C4052;
}
.dropdownSelector {
padding-top: 0px !important;
position: relative;
top: -4px;
text-align: center;
}
.navbar_cor_1 {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: alpha(opacity=1);
-moz-opacity: 1;
-khtml-opacity: 1;
opacity: 1;
}
.mopy_menu_1 {
text-transform: uppercase;
font-size: 16px;
font-weight: normal;
}
.mopy_menu_dropdown {
text-transform: none;
font-size: 16px;
font-weight: lighter;
}
.dropdownPadding {
padding-top: 20px;
padding-bottom: 20px;
}
#media screen and (min-width: 1800px) {
.container_mop{
width: 1750px;
background-color: black;
}
.dropdown-menu:before {
position: absolute;
top: -17px;
left: 10%;
display: inline-block;
border-right: 27px solid transparent;
border-bottom: 17px solid #ccc;
border-left: 27px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.dropdown-menu:after {
position: absolute;
top: -16px;
left: 10%;
display: inline-block;
border-right: 26px solid transparent;
border-bottom: 16px solid #4B617F;
border-left: 26px solid transparent;
content: '';
}
}
#media(min-width: 1700px) and (max-width: 1799px) {
.container_mop{
width: 1700px;
background-color: red;
}
}
#media(max-width: 480px) {
.odstepNadMenuFront {
background-color: red;
height: 120px;
}
.logo_top {
padding-top: 50px;
width: 90%;
}
.navbar_odstep {
padding-top: 50px;
padding-bottom: 0px;
}
.navbar_odstep{
padding:0 ;
}
}
When I have 480px width I have problem with scroll in menu (after click "gabinet" in menu - after open submenu). In desktop resolution I haven't any problems.
Screen with my problem:
https://imgur.com/a/bRJrIWh
Does anyone know how to fix it? The site uses Bootstrap 3
max-height is specified in bootstrap so you need to overwrite it by adding below css
.navbar-fixed-bottom .navbar-collapse, .navbar-fixed-top .navbar-collapse {
max-height: 100% !important;
}
LIVE SNIPPET
.navbar_odstep {
padding-top: 50px;
padding-bottom: 40px;
}
/*menu top*/
.navbar-default .navbar-nav > li > a {
color: white;
}
.navbar-default .navbar-nav > li > a:hover {
color: white;
}
.navbar-default .navbar-nav > li > a:focus {
color: white;
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .open > a:focus,
.navbar-default .navbar-nav > .open > a:hover {
background-color: transparent !important;
color: white !important;
}
.navbar-default .navbar-nav .open .dropdown-menu > li > a:focus,
.navbar-default .navbar-nav .open .dropdown-menu > li > a:hover {
background-color: #4B617F !important;
color: white !important;
}
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
background-color: #4B617F !important;
color: white !important;
}
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-color: #3C4052;
}
.dropdown-menu {
background-color: #4B617F !important;
}
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-color: #3C4052;
}
.navbar-default {
background-color: #3C4052;
border-color: #3C4052;
}
.dropdownSelector {
padding-top: 0px !important;
position: relative;
top: -4px;
text-align: center;
}
.navbar_cor_1 {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: alpha(opacity=1);
-moz-opacity: 1;
-khtml-opacity: 1;
opacity: 1;
}
.mopy_menu_1 {
text-transform: uppercase;
font-size: 16px;
font-weight: normal;
}
.mopy_menu_dropdown {
text-transform: none;
font-size: 16px;
font-weight: lighter;
}
.dropdownPadding {
padding-top: 20px;
padding-bottom: 20px;
}
.navbar-fixed-bottom .navbar-collapse, .navbar-fixed-top .navbar-collapse {
max-height: 100% !important;
}
#media screen and (min-width: 1800px) {
.container_mop{
width: 1750px;
background-color: black;
}
.dropdown-menu:before {
position: absolute;
top: -17px;
left: 10%;
display: inline-block;
border-right: 27px solid transparent;
border-bottom: 17px solid #ccc;
border-left: 27px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.dropdown-menu:after {
position: absolute;
top: -16px;
left: 10%;
display: inline-block;
border-right: 26px solid transparent;
border-bottom: 16px solid #4B617F;
border-left: 26px solid transparent;
content: '';
}
}
#media(min-width: 1700px) and (max-width: 1799px) {
.container_mop{
width: 1700px;
background-color: red;
}
}
#media(max-width: 480px) {
.odstepNadMenuFront {
background-color: red;
height: 120px;
}
.logo_top {
padding-top: 50px;
width: 90%;
}
.navbar_odstep {
padding-top: 50px;
padding-bottom: 0px;
}
.navbar_odstep{
padding:0 ;
}
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid container_mop">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#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>
</div>
<a class="navbar-brand" href="#"><img src="images/logo.png" class="center img-responsive logo_top"></a>
<div class="collapse navbar-collapse" id="navbar-collapse-1">
<ul class="nav navbar-nav navbar-left navbar_odstep">
<li class="mopy_menu_1">O mnie</li>
<li class=" mopy_menu_1 dropdown ">
gabinet <span class="caret"></span>
<ul class="dropdown-menu dropdownPadding">
<li class=" mopy_menu_dropdown">- Gdzie przyjmuje </li>
<li class=" mopy_menu_dropdown">- Badania </li>
<li class=" mopy_menu_dropdown">- Zabiegi</li>
<li class=" mopy_menu_dropdown">- Przygotowanie </li>
</ul>
</li>
<li class="mopy_menu_1">Usługi</li>
<li class="mopy_menu_1">Cennik</li>
<li class="mopy_menu_1">Artykuły</li>
</ul>
<ul class="nav navbar-nav navbar-right navbar_odstep">
<li class="mopy_menu_1">Kontakt</li>
</ul>
</div>
</div>
</nav>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

Remove border of navbar-left and right bootstrap on mobile menu

Hi am working on my navbar. When the navbar is in mobile view when I click and open the menu above and below the form input there looks to be like border-bottom
Like here
I am unable to find away to hide those two lines.
Question On when in mobile view how is it possible to remove / disable
those border-bottom above and below form input
Codepen Example
body {
background: url('../images/bg.png');
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 0;
}
hr {
border-top: 10px solid #444444;
position: fixed;
}
.navbar-left {
border-bottom: 0;
border-top: 0;
}
.navbar-form {
border-bottom: 0;
border-top: 0;
}
.page-wrapper {
margin-top: 40px;
}
#media (min-width: 768px) {
.custom-nav .navbar-nav > li > a {
padding-top: 15px;
padding-bottom: 15px;
min-width: 150px;
}
}
.custom-nav {
margin-bottom: 0;
background: #333333;
border: none;
border-radius: 0;
}
.custom-nav .navbar-brand {
color: #FFFFFF;
}
.custom-nav .navbar-brand:hover {
color: #FFFFFF;
}
.custom-nav .navbar-nav > .active > a,
.custom-nav .navbar-nav > .active > a:hover,
.custom-nav .navbar-nav > .active > a:focus {
background: none;
color: #ffffff;
}
.custom-nav .navbar-nav > li > a {
color: #ffffff;
font-size: 14.5px;
text-align: center;
}
.custom-nav .navbar-nav > li > a.home {
border-top: 2px solid #AC3931;
}
.custom-nav .navbar-nav > li > a.home:hover,
.custom-nav .navbar-nav > li > a.home:focus {
background-color: #AC3931;
}
.custom-nav .navbar-nav > li > a.forum {
border-top: 2px solid #F6AE2D;
}
.custom-nav .navbar-nav > li > a.forum:hover,
.custom-nav .navbar-nav > li > a.forum:focus {
background-color: #F6AE2D;
}
.custom-nav .navbar-nav > li > a.blog {
border-top: 2px solid #3B910D;
}
.custom-nav .navbar-nav > li > a.blog:hover,
.custom-nav .navbar-nav > li > a.blog:focus {
background-color: #3B910D;
}
.custom-nav .navbar-nav > li > a.codeigniter {
border-top: 2px solid #2868B7;
}
.custom-nav .navbar-nav > li > a.codeigniter:hover,
.custom-nav .navbar-nav > li > a.codeigniter:focus {
background-color: #2868B7;
}
#media only screen and (min-width: 1040px) {
.custom-nav .navbar-collapse {
padding-left: 0;
padding-right: 0;
}
}
#media only screen and (max-width: 1040px) {
.custom-nav .navbar-collapse .navbar-nav > li > a {
text-align: left;
}
.custom-nav .navbar-collapse .navbar-nav > li > a.home {
border-top: none;
border-left: 2px solid #AC3931;
}
.custom-nav .navbar-collapse .navbar-nav > li > a.forum {
border-top: none;
border-left: 2px solid #F6AE2D;
}
.custom-nav .navbar-collapse .navbar-nav > li > a.blog {
border-top: none;
border-left: 2px solid #3B910D;
}
.custom-nav .navbar-collapse .navbar-nav > li > a.codeigniter {
border-top: none;
border-left: 2px solid #2868B7;
}
}
.page {
background: #EEEEEE;
/*box-shadow: 6px 6px 0px #989898, 12px 12px 0px #6B6666;*/
min-height: 500px;
padding: 20px;
}
.module {
background: #fff;
padding: 20px;
margin-bottom: 40px;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}
.module .module-info {
color: #999;
font-size: 0.8em;
letter-spacing: 0.2em;
text-transform: uppercase;
font-family: 'source code pro';
}
.module .module-title {
font-size: 2.2em;
color: #000;
font-weight: bold;
display: block;
margin-bottom: 10px;
}
HTML
<div class="container">
<nav class="navbar navbar-inverse custom-nav">
<!-- 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="#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>
</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 class="home" href="#">Home</a></li>
<li><a class="forum" href="#">Forum</a></li>
<li><a class="blog" href="#">Blog</a></li>
<li class="dropdown">
CodeIgniter <span class="caret"></span>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-right">
<span class="fa fa-search"></span>
<input type="text" class="form-control" placeholder="Search">
</form>
</div><!-- /.navbar-collapse -->
</nav>
</div><!-- /.container-->
Put box-shadow: none; to <form class="navbar-form navbar-right"> and the problem will be solved.
Code:
form.navbar-form.navbar-right {
box-shadow: none;
}
Codepen: → here.
try the below code
#media (max-width: 768px){
.navbar-form{
-webkit-box-shadow:none;
box-shadow:none;
}
}
Thanks to every ones solution
SOLVED
When I just added box shadow none on it's own it still showed lines but darker
There for I have had to add border-top 0 and
border-bottom 0 and it worked
.navbar-form {
box-shadow: none;
border-top: 0;
border-bottom: 0;
}
Problem Solved.

Custom css on bootstrap navbar not displaying correct

On my bootstrap navbar when the navbar is in desktop mode it should show my border-top css
But for some reason it shows my border-left css It should only show border-left when mobile 768px and under.
Question: How can I make sure when the navbar is shows the correct border for when it is in mobile or desktop
Codepen Example
body {
background: #222;
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 0;
}
hr {
border-top: 10px solid #444444;
position: fixed;
}
.page-wrapper {
margin-top: 40px;
}
.custom-nav {
margin-bottom: 0;
background: #333333;
border: none;
border-radius: 0;
}
.custom-nav .navbar-brand {
color: #FFFFFF;
}
.custom-nav .navbar-brand:hover {
color: #FFFFFF;
}
.custom-nav .navbar-nav > .active > a,
.custom-nav .navbar-nav > .active > a:hover,
.custom-nav .navbar-nav > .active > a:focus {
background: none;
color: #ffffff;
}
.custom-nav .navbar-nav > li > a {
color: #ffffff;
font-size: 14.5px;
text-align: center;
}
.custom-nav .navbar-nav > li > a.home {
border-top: 2px solid #AC3931;
}
.custom-nav .navbar-nav > li > a.home:hover,
.custom-nav .navbar-nav > li > a.home:focus {
background-color: #AC3931;
}
.custom-nav .navbar-nav > li > a.forum {
border-top: 2px solid #F6AE2D;
}
.custom-nav .navbar-nav > li > a.forum:hover,
.custom-nav .navbar-nav > li > a.forum:focus {
background-color: #F6AE2D;
}
.custom-nav .navbar-nav > li > a.blog {
border-top: 2px solid #3B910D;
}
.custom-nav .navbar-nav > li > a.blog:hover,
.custom-nav .navbar-nav > li > a.blog:focus {
background-color: #3B910D;
}
.custom-nav .navbar-nav > li > a.examples {
border-top: 2px solid #2868B7;
}
.custom-nav .navbar-nav > li > a.examples:hover,
.custom-nav .navbar-nav > li > a.examples:focus {
background-color: #2868B7;
}
.custom-nav .navbar-collapse .navbar-nav > li > a.home {
border-top: none;
border-left: 2px solid #AC3931;
}
.custom-nav .navbar-collapse .navbar-nav > li > a.forum {
border-top: none;
border-left: 2px solid #F6AE2D;
}
.custom-nav .navbar-collapse .navbar-nav > li > a.blog {
border-top: none;
border-left: 2px solid #3B910D;
}
.custom-nav .navbar-collapse .navbar-nav > li > a.examples {
border-top: none;
border-left: 2px solid #2868B7;
}
.page {
background: #EEEEEE;
/*box-shadow: 6px 6px 0px #989898, 12px 12px 0px #6B6666;*/
min-height: 500px;
padding: 20px;
}
.module {
background: #fff;
padding: 20px;
margin-bottom: 40px;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}
.module .module-info {
color: #999;
font-size: 0.8em;
letter-spacing: 0.2em;
text-transform: uppercase;
font-family: 'source code pro';
}
.module .module-title {
font-size: 2.2em;
color: #000;
font-weight: bold;
display: block;
margin-bottom: 10px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="page-wrapper">
<div class="container">
<nav class="navbar navbar-inverse custom-nav">
<!-- 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="#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>
</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 class="home" href="#">Home</a></li>
<li><a class="forum" href="#">Forum</a></li>
<li><a class="blog" href="#">Blog</a></li>
<li class="dropdown">
CodeIgniter Examples <span class="caret"></span>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</nav>
</div><!-- /.container-->
</div>
<script src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
You can use CSS #media rule and then put all related CSS code for particular mobile with screen size inside it, like below:
.custom-nav .navbar-nav > li > a.examples {
border-top: 2px solid #2868B7;
}
.custom-nav .navbar-nav > li > a.examples:hover,
.custom-nav .navbar-nav > li > a.examples:focus {
background-color: #2868B7;
}
#media only screen and (max-width: 768px) {
.custom-nav .navbar-collapse .navbar-nav > li > a.home {
border-top: none;
border-left: 2px solid #AC3931;
}
.custom-nav .navbar-collapse .navbar-nav > li > a.forum {
border-top: none;
border-left: 2px solid #F6AE2D;
}
.custom-nav .navbar-collapse .navbar-nav > li > a.blog {
border-top: none;
border-left: 2px solid #3B910D;
}
.custom-nav .navbar-collapse .navbar-nav > li > a.examples {
border-top: none;
border-left: 2px solid #2868B7;
}
}
For more detail check here.. Hope it helps.
You should add you border-left css in a media query with max-width:768px.
#media (max-width:768px){
/*put your css here*/
}
It will apll your css only on screen width of 768px and below.
You can use media queries to set different breakpoints and change the style for each break point. Something like the following:
/* Desktops and laptops ----------- */
#media only screen and (min-width : 1224px) {
/* Styles */
}

issue styling bootstrap navbar when collapse

I am using the below css in my code to achieve a transparent white navbar but after collapsing menu in mobile version background style doesn't work. please help me to overcome this issue. i tried most of the solutions found in other questions
#header_wrapper {
background: rgba(255, 255, 255, 0.82);
}
.header_box {
position: relative;
}
.header{
position: fixed;
top: 0;
left: 0;
width: 100%;
padding: 15px 0px 10px 0px;
z-index: 10000;
transition: all 0.2s ease-in;
height: 100px;
background-color:transparent;
text-align: center;
line-height: 40px;
}
.header.active {
background: rgba(255, 255, 255, 0.82);
}
.logo {
float: left;
position: relative;
z-index: 2;
}
.res-nav_click {
display: none;
}
/* Nav Styles
---------------------------------*/
.navbar-inverse {
background-color: transparent;
border-color: transparent;
}
.navbar {
border: 0px solid #fff;
min-height: 40px;
margin-bottom: 0px;
}
.navbar-inverse .navbar-nav > li > a {
color: #000;
}
.navStyle {
float: right;
}
.navStyle ul {
list-style: none;
padding: 0px;
margin-top:25px;
}
.navStyle ul li {
display: inline-block;
margin: 0 5px;
}
.navStyle ul li:first-child {
/*margin:0px;*/;
}
.navStyle ul li:last-child {
margin: 0 0 0 23px;
}
.navStyle ul li a {
display: block;
font-size: 15px;
color: #222222;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
text-decoration: none;
text-transform: uppercase;
font-weight: 300;
transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-webkit-transition: all 0.2s ease-in-out;
}
.navStyle ul li a:hover {
color: #ffc000;
border: 0px solid #fff;
}
.navStyle > li > a:hover, .nav > li > a:focus {
text-decoration: none;
color: #ffc000;
background-color: transparent;
}
.navbar-inverse .navbar-nav > li > a:hover, .navbar-inverse .navbar-nav > li > a:focus {
color: #ffc000;
background-color: transparent;
}
.navbar-inverse .navbar-nav > .active > a, .navbar-inverse .navbar-nav > .active > a:hover, .navbar-inverse .navbar-nav > .active > a:focus {
color: #ffc000;
background-color: transparent;
}
.navStyle > li.active > a,
.navStyle > li.active > a:hover {
text-decoration: none;
color: #ED5441;
background-color: transparent;
}
HTML:
<header id="header_wrapper" class="header active border">
<div class="container">
<div class="header_box">
<div class="logo"><img src="images/logo.png" alt="logo"></div>
<nav class="navbar navbar-inverse" role="navigation">
<div class="navbar-header">
<button type="button" id="nav-toggle" class="navbar-toggle" data-toggle="collapse" data-target="#main-nav"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
</div>
<div id="main-nav" class="collapse navbar-collapse navStyle">
<ul class="nav navbar-nav" id="mainNav">
<li class="active">Home
Home
</li>
<li>About Us
About Us
</li>
<li>Products
Products
</li>
<li>Services
Services
</li>
<li>Group
Group
</li>
<li>Careers
Career
</li>
<li>Contact Us
Contact Us
</li>
</ul>
</div>
</nav>
</div>
</div>
</header>
http://globaltrendz.com/blackandgreen/ please refer this one by changing header-wrapper bgcolor opactiy. like this one what i need
I am assuming that you want mobile navbar after 765px so you need to use a media query on that.
Add this at the end of your css file:
#media screen and (max-width: 765px){
.navStyle ul{
position: fixed;
left: 0;
background: rgba(255, 255, 255, 0.82) !important; //important //because you have inline styles.
}
}
Here's the output:
got the solution by applying below styles
.navbar-inverse {
background-color: rgba(222,222,222,0.84);
border-color: transparent;
width:100%;
position:fixed;
left:0;
}
.navStyle ul {
background-color: rgba(222,222,222,0.84);
}

Resources