Stop Bootstrap 3 hamburger menu dropdowns from displaying on hover - css

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>

Related

How to fix dropdown menu hover not woking

I try to make dropdown menu but it only works click event, hover event but do not work. Anyone can help me why my code does not work? This is my code below:
=======================================================
html code
.topnav {
color: white;
overflow: hidden;
background-color: #5f5f5f;
}
.topnav a {
float: left;
display: block;
font-size: 17px;
color: #f1f1f1;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.topnav a:hover {
background-color: black;
}
.topnav a:active,
a:focus {
background-color: #4CAF50 !important;
}
.is-active {
color: #f1f1f1;
background-color: #4CAF50;
}
.dropdown-menu {
padding: 0 !important;
background-color: #5f5f5f;
border-radius: 0 !important;
}
.dropdown-menu li a {
color: white;
text-align: left;
width: 100% !important;
}
.m-dropdown-menu:hover>.dropdown-menu {
display: block;
}
<div class="topnav">
<a [routerLinkActive]="['is-active']" routerLink="home">Home</a>
<a [routerLinkActive]="['is-active']" routerLink="about">About</a>
<a [routerLinkActive]="['is-active']" routerLink="contact">Contact</a>
<div class="m-dropdown-menu">
Dropdown
<ul class="dropdown-menu">
<li><a routerLink="#">Reactive form</a></li>
</ul>
</div>
</div>
Sorry if my english is bad. Thank you very so much.
You will need to remove
overflow:hidden from top-nav and float:left from a element
so your css will look like
.topnav {
color:white;
background-color: #5f5f5f;
}
.topnav a {
display: block;
font-size: 17px;
color: #f1f1f1;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.topnav a:hover {
background-color:black;
}
.topnav a:active, a:focus {
background-color: #4CAF50 !important;
}
.is-active {
color: #f1f1f1;
background-color: #4CAF50;
}
.dropdown-menu {
padding: 0 !important;
background-color: #5f5f5f;
border-radius: 0 !important;
}
.dropdown-menu li a {
color:white;
text-align: left;
width: 100% !important;
}
.m-dropdown-menu:hover > .dropdown-menu {
display: block;
}
Working demo
I Just update your code structure with few CSS changes. Try this I hope it'll help you out. Thanks
.topnav {
color:white;
background-color: #5f5f5f;
}
.topnav ul {
list-style: none;
margin: 0;
padding: 0 !important;
}
.topnav ul li {
position: relative;
display: inline-block;
}
.topnav ul li:hover .dropdown-menu {
display: block;
}
.topnav a {
display: block;
font-size: 17px;
color: #f1f1f1;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.topnav a:hover {
background-color:black;
}
.topnav a:active, a:focus {
background-color: #4CAF50 !important;
}
.is-active {
color: #f1f1f1;
background-color: #4CAF50;
}
.dropdown-menu {
background-color: #5f5f5f;
border-radius: 0 !important;
display: none;
position: absolute;
width: 150px;
}
.dropdown-menu li a {
color:white;
text-align: left;
width: 100% !important;
}
<div class="topnav">
<ul>
<li>
<a [routerLinkActive]="['is-active']" routerLink="home">Home</a>
</li>
<li>
<a [routerLinkActive]="['is-active']" routerLink="about">About</a>
</li>
<li>
<a [routerLinkActive]="['is-active']" routerLink="contact">Contact</a>
</li>
<li>
Dropdown
<ul class="dropdown-menu">
<li><a routerLink="#">Reactive form</a></li>
</ul>
</li>
</ul>
</div>
Try using ">" in css.
example:
.topnav > a:hover {
background-color:black;
}

Unwanted see-though spaces between menu items (border not working)

This is a pure CSS navbar I got from CSS Tricks. I've been racking my brain trying to figure out what's causing the blank, open, see-through space below each item on the drop-down menu, going over every CSS property, but I can't get it. You can see the image slider through them, and we don't want that. Can anyone help?
It's more obvious on the web than in the fiddle.
Here's the HTML:
<nav>
<ul class="nav"> <!-- Menu from https://css-tricks.com/targetting-menu-elements-submenus-navigation-bar/ -->
<li>Home</li>
<li>Services
<ul class="align-left">
<li>Drug Formulation</li>
<li>Analytical & Bioanalytical Services</li>
<li>Thermal Analysis</li>
<li>Custom Synthesis</li>
<li>Pharmacology & Toxicology</li>
<li>Regulatory Support for Drugs & Medical Devices</li>
<li>Materials Testing</li>
<li>Catalog of Chemical Reagents & Materials</li>
<li>Food Analysis</li>
</ul>
</li>
<li>Technologies
<ul class="align-left">
<li>API Micronization</li>
<li>Drug Delivery
<ul class="align-left">
<li>Sol-gel Encapsulation</li>
<li>Smart Hydrogels and Biomaterials</li>
<li>Electrorheologically-Controlled Drug Release</li>
<li>Polyphosphazenes</li>
</ul>
<li>Materials Science
<ul class="align-left">
<li>Coatings</li>
<li>Structural Materials</li>
<li>Viscosity Control: Non-aqueous Systems</li>
</ul>
</li>
</ul>
</li>
<li>Bio-Pharma Storage</li>
<li>About Us</li>
<li>News</li>
<li>Contact</li>
</ul>
</nav>
And the CSS:
nav {
display: block;
width:100%;
text-align: center;
}
nav ul {
margin: 0;
padding: 0;
list-style: none;
}
.nav a {
display: block;
background-color: #003399;
color: white;
text-decoration: none;
padding: .5em 1.4em .7em;
font-size: 75%;
letter-spacing: 1px;
position: relative;
}
.nav {
vertical-align: top;
display: inline-block;
border-radius: 6px;
}
.nav li { position: relative; }
.nav > li {
float: left;
border-bottom: 4px #aaa solid;
margin-right: 1px;
}
.nav > li > a {
margin-bottom: 1px;
}
.nav > li:hover, .nav > li:hover >a { border-bottom-color: #99ddff; }
.nav li:hover > a { color: #99ddff; }
.nav > li:first-child { border-radius: 4px 0 0 4px; }
.nav > li:first-child>a { border-radius: 4px 0 0 0; }
.nav > li:last-child {
border-radius: 0 0 4px 0;
margin-right: 0;
}
.nav > li:last-child >a { border-radius: 0 4px 0 0; }
.nav li li a { margin-top: 1px }
.nav li a:first-child:nth-last-child(2):before {
content: "";
position: absolute;
height: 0;
width: 0;
border: 5px solid transparent;
top: 50%;
right: 5px;
}
/* submenu positioning*/
.nav ul {
position: absolute;
white-space: nowrap;
border-bottom: 5px solid #99ddff;
z-index: 1;
left: -99999em;
}
.nav > li:hover > ul {
left: auto;
padding-top: 5px;
min-width: 100%;
}
.nav > li li ul { border-left: 1px solid #fff; }
.nav > li li:hover > ul {
/* margin-left: 1px */
left: 100%;
top: -1px;
}
/* arrow hover styling */
.nav > li > a:first-child:nth-last-child(2):before { border-top-color: white; }
.nav > li:hover > a:first-child:nth-last-child(2):before {
border: 5px solid transparent;
border-bottom-color: orange;
margin-top: -5px
}
.nav li li > a:first-child:nth-last-child(2):before {
border-left-color: #aaa;
margin-top: -5px
}
.nav li li:hover > a:first-child:nth-last-child(2):before {
border: 5px solid transparent;
border-right-color: orange;
right: 10px;
}
.align-left { text-align: left; }
.nav > li {
float: left;
border-bottom: 4px #aaa solid;
margin-right: 1px;
}
remove the margin-right :-)

bootstrap navbar height issue

I have a bootstrap nav fixed top with height of 120px, the nav itself looks as I want. but when it goes mobile size the links are the same height as the nav bar. I cannot figure out what I am missing..
.navbar {
background-color: rgba(0, 0, 0, .6);
box-shadow: 1px 1px 4px 0 rgba(0, 0, 0, .1);
min-height:120px !important;
}
.navbar-nav > ul, li {
padding: 0px 15px;
}
.contain-pull{
max-width: 93%;
margin: 0 auto 0 auto;
}
.navbar-nav > li > a, .navbar-brand {
padding-top:50px !important;
padding-bottom:0 !important;
height: 120px;
}
.navbar a {
color: #fff !important;
text-transform: uppercase;
font-size: 14px;
font-weight: 300px;
font-family: 'Oswald', sans-serif;
text-decoration: none;
}
.navbar a:hover{
color:#258faf !important;
}
.navbar {
border: 0px;
}
.logo {
display: block;
text-decoration: none;
max-height: 95px;
margin: 12px 0px 0px 0px;
width: auto;
}
#media (max-width: 960px) {
.navbar-header {
float: none;
}
.navbar-left,.navbar-right {
float: none !important;
}
.navbar-toggle {
display: block;
margin-top: 40px;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin-top: 7.5px;
}
.navbar-nav>li {
float: none;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.collapse.in{
display:block !important;
}
}
You can simple place your link rules inside of a media query:
#media (min-width: 960px) {
.navbar.navbar-tall .navbar-nav > li > a {
padding-top: 50px;
padding-bottom: 0;
height: 120px;
}
}
This example keeps the link height at the default settings once the navbar has collapsed.
Working Example: Open Example with FullPage and reduce the browser size.
.navbar.navbar-tall {
background-color: rgba(0, 0, 0, .6);
box-shadow: 1px 1px 4px 0 rgba(0, 0, 0, .1);
min-height: 120px;
border: 0px;
}
.navbar.navbar-tall .navbar-nav > li > a {
color: #fff;
text-transform: uppercase;
font-size: 14px;
font-weight: 300px;
font-family: 'Oswald', sans-serif;
text-decoration: none;
}
.navbar.navbar-tall .navbar-nav > li > a:hover {
color: #258faf;
}
.navbar.navbar-tall .navbar-brand {
padding-top: 50px;
padding-bottom: 0;
height: 120px;
}
#media (min-width: 960px) {
.navbar.navbar-tall .navbar-nav > li > a {
padding-top: 50px;
padding-bottom: 0;
height: 120px;
}
}
#media (max-width: 959px) and (min-width: 768px) {
.navbar.navbar-fixed-bottom .navbar-collapse,
.navbar.navbar-fixed-top .navbar-collapse {
max-height: auto;
overflow-x: visible;
}
}
#media (max-width: 959px) {
.navbar .navbar-header {
float: none;
}
.navbar .navbar-left,
.navbar .navbar-right {
float: none !important;
}
.navbar .navbar-right {
margin-right: 0px;
}
.navbar .navbar-right~.navbar-right {
margin-right: 0;
}
.navbar .navbar-toggle {
display: block;
margin-top: 42.50px;
}
.navbar .navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.navbar.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar .navbar-collapse.collapse {
display: none!important;
overflow: visible!important;
}
.navbar .navbar-nav {
float: none!important;
margin-top: 7.5px;
}
.navbar .navbar-nav>li {
float: none;
}
.navbar .navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.navbar .collapse.in {
display: block !important;
overflow-y: auto;
}
.navbar .navbar-nav .dropdown-menu > li > a,
.navbar .navbar-nav .dropdown-menu > li > a:hover,
.navbar .navbar-nav .dropdown-menu > li > a:focus {
color: #777;
}
.navbar .navbar-nav .open .dropdown-menu {
position: static;
float: none;
width: auto;
margin-top: 0;
background-color: transparent;
border: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="navbar navbar-inverse navbar-fixed-top navbar-tall">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Brand</a>
</div>
<div class="navbar-collapse collapse" id="navbar">
<ul class="nav navbar-nav navbar-right">
<li>Link
</li>
<li>Link
</li>
<li>Link
</li>
</ul>
</div>
</div>
</div>
<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>
it is normal that the height you put for large screen for the navbar (120px) will be seen in the small devices.
Keep the height of the Navbar small.
Incase if you want to increase height of navbar in large device you can play with
padding of the <a> (anchor inside the nav)
If you observe the toggle button in html it throws a class;
class="navbar-toggle collapsed" data-toggle="collapse"
and when the toggle-button is open it throws the class as;
class="navbar-collapse collapse in"
now according to as above class you can style your navbar <a>tags.
i hope this heps you in something to trying to achieve.

My pure CSS dropdown isn't working, anybody knows how to fix it? [duplicate]

This question already has answers here:
My inline-block elements are not lining up properly
(5 answers)
Closed 6 years ago.
I'm a CSS starter and my pure CSS dropdown isn't working.
Example in this jsfiddle: https://jsfiddle.net/uevewfsy/
I've been looking around on internet and trying to fix it myself but I have tried countless things and it still isn't fixed. Having a float: left; on the primary ul seems to fix it, but then my nav isn't centered anymore.
Hope someone can help me so I can go further with programming again ;)
* {
padding: 0;
margin: 0;
border: 0;
}
html, body {
height: 100%;
width: 100%;
font-family: 'Open Sans', sans-serif;
}
h1 {
font-weight: 100;
}
.nav {
width: 100%;
height: 10%;
background-color: #333;
text-align: center;
position: fixed;
z-index: 150;
}
.nav ul {
height: 100%;
width: 100%;
}
.nav > ul > li {
display: inline-block;
list-style: none;
margin: 0 20px 0 20px;
}
.nav > ul > li:first-child > a:after {
width: 6px;
height: 6px;
border-bottom: 1px solid white;
border-right: 1px solid white;
position: absolute;
margin-top: calc(5vh - 5px);
margin-left: 8px;
content: "";
transform: rotate(45deg);
}
.nav > ul > li > ul {
display: none;
}
.nav > ul > li > ul > li {
list-style: none;
background-color: #333;
padding: 0 15px 0 15px;
}
.nav li:hover > ul {
display: block;
}
.nav ul a {
color: #A3ABA3;
text-decoration: none;
line-height: 10vh;
}
.nav a:hover {
color: #FFF;
}
#media only screen and (max-device-width: 480px){
}
<body>
<div class="nav">
<ul>
<li>
PAGE
<ul>
<li>DROPDOWN</li>
<li>DROPDOWN</li>
</ul>
</li>
<li>PAGE</li>
<li>PAGE</li>
<li>PAGE</li>
</ul>
</div>
</body>
you are just missing vertical-align:top in your nav > ul > li,
you can add position:relative/top to your li/ul as well.
* {
padding: 0;
margin: 0;
border: 0;
}
html,
body {
height: 100%;
width: 100%;
font-family: 'Open Sans', sans-serif;
}
h1 {
font-weight: 100;
}
.nav {
width: 100%;
height: 10%;
background-color: #333;
text-align: center;
position: fixed;
z-index: 150;
}
.nav ul {
height: 100%;
width: 100%;
}
.nav > ul > li {
display: inline-block;
list-style: none;
padding: 0 20px;
vertical-align: top
}
.nav > ul > li:first-child > a:after {
width: 6px;
height: 6px;
border-bottom: 1px solid white;
border-right: 1px solid white;
position: absolute;
margin-top: calc(5vh - 5px);
margin-left: 8px;
content: "";
transform: rotate(45deg);
}
.nav > ul > li > ul {
display: none;
}
.nav > ul > li > ul > li {
list-style: none;
background-color: #333;
padding: 0 15px;
position:relative
}
.nav li:hover > ul {
display: block;
position:absolute;
top:100%;
width:30%
}
.nav ul a {
color: #A3ABA3;
text-decoration: none;
line-height: 10vh;
}
.nav a:hover {
color: #FFF;
}
#media only screen and (max-device-width: 480px) {}
<body>
<div class="nav">
<ul>
<li>
PAGE
<ul>
<li>DROPDOWN
</li>
<li>DROPDOWN
</li>
</ul>
</li>
<li>PAGE
</li>
<li>PAGE
</li>
<li>PAGE
</li>
</ul>
</div>
</body>

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