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);
}
Related
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>
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>
Have a Sidebar in a MVC project, created from DB and injected as HTML on view.
On the whole, it works well apart from two annoying traits.
If submenu items are opened they don't collapse if another one is opened
If a submenu item is clicked it does collapse when it should stay open
This needs to be the other way round
Probably an easy CSS issue, but after going through it nothing jumps out.
The generated HTML is
div class="nav-side-menu">
<div class="brand">Band Name</div>
<i class="fa fa-bars fa-2x toggle-btn" data-toggle="collapse" data-target="#menu-content"></i>
<div class="menu-list">
<ul id="menu-content" class="menu-content collapse out">
<li data-toggle="collapse" class="collapsed active"><i class="fa fa-gift fa-lg"></i>Overview<span class="arrow"></span></li>
<li data-toggle="collapse" class="collapsed active"><i class="fa fa-gift fa-lg"></i>Terms of Use (Licence)<span class="arrow"></span></li>
<li data-toggle="collapse" class="collapsed active"><i class="fa fa-gift fa-lg"></i>System Requirements<span class="arrow"></span></li>
<li data-toggle="collapse" class="collapsed active"><i class="fa fa-gift fa-lg"></i>Installation<span class="arrow"></span></li>
<li data-toggle="collapse" data-target="#5" class="collapsed active">
<a><i class="dropdown-toggle" data-toggle="dropdown"></i>Message Centre <span class="caret" ></span></a>
<ul class="sub-menu collapse" id="5">
<li>News</li>
<li>Communications</li>
</ul>
</li>
<li data-toggle="collapse" data-target="#8" class="collapsed active">
<a><i class="dropdown-toggle" data-toggle="dropdown"></i>Website <span class="caret"></span></a>
<ul class="sub-menu collapse" id="8">
<li>Login</li>
</ul>
</li>
</ul>
</div>
</div>
and the CSS is
<style>
.nav-side-menu {
overflow: auto;
font-family: verdana;
font-size: 12px;
font-weight: 200;
background-color: #2e353d;
position: fixed;
top: 0px;
width: 300px;
height: 100%;
color: #e1ffff;
}
.nav-side-menu .brand {
background-color: #23282e;
line-height: 50px;
display: block;
text-align: center;
font-size: 14px;
}
.nav-side-menu .toggle-btn {
display: none;
}
.nav-side-menu ul,
.nav-side-menu li {
list-style: none;
padding: 0px;
margin: 0px;
line-height: 35px;
cursor: pointer;
}
.nav-side-menu ul :not(collapsed) .arrow:before,
.nav-side-menu li :not(collapsed) .arrow:before {
font-family: FontAwesome;
content: "\f078";
display: inline-block;
padding-left: 10px;
padding-right: 10px;
vertical-align: middle;
float: right;
}
.nav-side-menu ul .active,
.nav-side-menu li .active {
border-left: 3px solid #d19b3d;
background-color: #4f5b69;
}
.nav-side-menu ul .sub-menu li.active,
.nav-side-menu li .sub-menu li.active {
color: #d19b3d;
}
.nav-side-menu ul .sub-menu li.active a,
.nav-side-menu li .sub-menu li.active a {
color: #d19b3d;
}
.nav-side-menu ul .sub-menu li,
.nav-side-menu li .sub-menu li {
background-color: #181c20;
border: none;
line-height: 28px;
border-bottom: 1px solid #23282e;
margin-left: 0px;
}
.nav-side-menu ul .sub-menu li:hover,
.nav-side-menu li .sub-menu li:hover {
background-color: #020203;
}
.nav-side-menu ul .sub-menu li:before,
.nav-side-menu li .sub-menu li:before {
font-family: FontAwesome;
content: "\f105";
display: inline-block;
padding-left: 10px;
padding-right: 10px;
vertical-align: middle;
}
.nav-side-menu li {
padding-left: 0px;
border-left: 3px solid #2e353d;
border-bottom: 1px solid #23282e;
}
.nav-side-menu li a {
text-decoration: none;
color: #e1ffff;
}
.nav-side-menu li a i {
padding-left: 10px;
width: 20px;
padding-right: 20px;
}
.nav-side-menu li:hover {
border-left: 3px solid #d19b3d;
background-color: #4f5b69;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-ms-transition: all 1s ease;
transition: all 1s ease;
}
#media (max-width: 767px) {
.nav-side-menu {
position: relative;
width: 100%;
margin-bottom: 10px;
}
.nav-side-menu .toggle-btn {
display: block;
cursor: pointer;
position: absolute;
right: 10px;
top: 10px;
z-index: 10 !important;
padding: 3px;
background-color: #ffffff;
color: #000;
width: 40px;
text-align: center;
}
.brand {
text-align: left !important;
font-size: 22px;
padding-left: 20px;
line-height: 50px !important;
}
}
#media (min-width: 767px) {
.nav-side-menu .menu-list .menu-content {
display: block;
}
#main {
width: calc(100% - 300px);
float: right;
}
}
body {
margin: 0px;
padding: 0px;
}
</style>
For the first issue, you can simply wrap the accordion portion of the menu with an id:
<div class="accordion-group">
Then add this JS code to fix your accordion problem:
/* ensure any open panels are closed before showing selected */
$('.accordion-group').on('show.bs.collapse', function () {
$('.accordion-group .in').collapse('hide');
});
For the second issue, you just need to move the data-toggle="collapse" and data-target="#5" to the a element of the sub-menu so that the anchor is the only thing that toggles the collapse (not the entire list item which includes all of its content).
<li class="collapsed active">
<a data-toggle="collapse" data-target="#5"><i></i>Message Centre <span class="caret" ></span></a>
...
</li>
Demo: JSFiddle
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.
I have a search box placed inside a bunch of <li> tags in my Bootstrap Navbar. It works fine in regular mode; however, when collapsed, it disappears upon touch, along with the rest of the drop-down. Here's the HTML markup:
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".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>
<a class="navbar-brand" href="#"><img src="bootstrap/img/gray_logo.png" class="site-logo"><span class="site-name-first">Always</span><span class="site-name-second">Spanish</span></a>
</div>
<!-- Navbar links -->
<div class="collapse navbar-collapse" ng-controller="HeaderController">
<ul class="nav navbar-nav navbar-right">
<li ng-class="{ active: isActive('/about')}">About</li>
<li ng-class="{ active: isActive('/blog')}">Blog</li>
<li>Premium</li>
<li>Books</li>
<li>Contact</li>
<li>
<!-- Search box -->
<form class="navbar-form pull-right search-box" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="srch-term" id="srch-term">
<div class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
</li>
</ul>
</div>
</div>
</div>
I understand this is by design as the drop down must disappear once an item is tapped. But this functionality also means one wouldn't be able to use the search box in the collapsed mode. Is there any (preferably pure CSS) workaround? Here's the drop down I am talking about:
This is what the navbar looks like on a regular desktop viewport:
Here's the complete CSS:
* {
border-radius: 0 !important;
}
#media (max-width: 760px) {
h1 {
font-size: 210%;
}
.jumbotron p {
font-size: 120%;
}
}
.navbar-text > a {
color: inherit;
text-decoration: none;
}
body {
padding-top: 50px;
}
.row-padding {
padding-left: 20px;
padding-right: 20px;
padding-bottom: 50px;
}
p {
font-family: 'Open Sans', sans-serif;
}
h1, h2, h3, h4, h5, h6 {
font-family: 'Oswald', sans-serif;
}
.site-name-first {
padding-left: 10px;
font-family: 'Caesar Dressing', cursive;
font-size: 1.5em;
color: #6495ed;
}
.site-name-second {
font-family: 'Caesar Dressing', cursive;
font-size: 1.5em;
color: #ff6666;
}
.site-logo {
float:left;
margin-top: -8px;
width: 36px;
}
/* CSS to change Navbar collapse threshold [START]
===================================================================*/
#media (max-width: 991px) {
.navbar-header {
float: none;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin: 7.5px -15px;
}
.navbar-nav>li {
float: none;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.navbar-text {
float: none;
margin: 15px 0;
}
/* since 3.1.0 */
.navbar-collapse.collapse.in {
display: block!important;
}
.collapsing {
overflow: hidden!important;
}
}
/* CSS to change Navbar collapse threshold [END]
===================================================================*/
#media (min-width: 761px) {
.navbar-default {
background-color: rgba(255, 255, 255, 0.9);
border-bottom: 0px;
color: #666666;
margin: 0px;
}
}
#media (max-width: 760px) {
.navbar-default {
background-color: rgba(255, 255, 255, 1);
border-bottom: 0px;
color: #666666;
margin: 0px;
}
}
/*.search-box {
margin-right: -15px;
}*/
.navbar-static-bottom {
background-color: #ffcc00;
border: none;
color: #665100;
margin-bottom: 0px;
padding-top: 0px;
}
.navbar-static-bottom .socials {
color: #665100;
}
.footer-text {
padding-top: 17px;
}
.footer-text a {
color: #665100;
}
.navbar-default .navbar-nav > li > a,
.navbar-default .navbar-nav > li > a:focus {
outline: none;
color: #70704c;
font-weight: 700;
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
background-color: #ffffff;
box-shadow: inset 0 -5px 0 0 #665100;
}
.navbar-default .navbar-nav > li > a:hover {
background-color: #ffffff;
box-shadow: inset 0 -5px 0 0 #cca300;
color: #cca300;
transition: color 0.15s ease;
}
/* when a dropdown menu item is clicked open */
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .open > a:hover,
.navbar-default .navbar-nav > .open > a:focus {
background-color: #ffffff;
box-shadow: inset 0 -5px 0 0 #cca300;
}
.home-thumb img:hover {
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-ms-transform: scale(1.1);
-o-transform: scale(1.1);
transform: scale(1.1);
}
.thumbnail img {
-webkit-transition: all 0.3s ease 0s;
-moz-transition: all 0.3s ease 0s;
-o-transition: all 0.3s ease 0s;
transition: all 0.3s ease 0s;
width: 100%;
}
.thumbnail {
overflow: hidden;
}
.bg-gray {
background-color: #f9f9f9;
}
.facebook-color:hover { color: #3b5998; }
.twitter-color:hover { color: #4099ff; }
.googleplus-color:hover { color: #d50f25; }
.youtube-color:hover { color: #c4302b; }
.pinterest-color:hover { color: #c92228; }
.top-jumbotron {
background: #ffcc00;
height: 500px;
margin: 0px;
border: none;
}
.second-jumbotron {
margin: 0px;
background: #332800;
color: #ffcc00;
font-size: 500%;
line-height: 50%;
padding-top: 0.3em;
padding-bottom: 0.6em;
font-family: 'Mr Dafoe', cursive;
}
.contact-box {
border-color: #ffcc00;
}
.contact-title {
text-align: center;
background-color: #ffcc00;
border-color: #ffcc00;
}
.contact-title h4 {
font-size: 220%;
color: #545454;
}
.contact-body {
background-color: #ffea99;
border-color: #ffea99;
color: #545454;
}
.contact-footer {
background-color: #ffcc00;
border-color: #ffcc00;
}
.contact-field {
background-color: #fff9e5;
box-shadow: #b2b2b2 0px 0px 8px;
}
.contact-field:hover,
.contact-field:focus {
background-color: #fff;
box-shadow: #b2b2b2 0px 0px 03px inset;
}
.contact-field-single {
height: 3em;
}
.contact-send {
background-color: #4c3d00;
border-color: #4c3d00;
color: #ffffff;
width: 7em;
}
.contact-send:hover,
.contact-send:focus,
.contact-send:active {
background-color: #2d2400;
border-color: #2d2400;
color: #ffffff;
}
.contact-close {
background-color: #938a66;
border-color: #938a66;
color: #ffffff;
width: 7em;
}
.contact-close:hover,
.contact-close:focus,
.contact-close:active {
background-color: #81774c;
border-color: #81774c;
color: #ffffff;
}
.airmail {
width: 50px;
float: left;
padding: 0px;
}
.pre-footer-jumbotron {
background-color: #ffefb2;
height: 50px;
margin-bottom: 0px;
}
As far as I'm concerned the easiest solution is to remove the form from li and add it separately as described in bootstrap documentation.
<ul class="nav navbar-nav navbar-right">
<li ng-class="{ active: isActive('/about')}">About</li>
<li ng-class="{ active: isActive('/blog')}">Blog</li>
<li>Premium</li>
<li>Books</li>
<li>Contact</li>
</ul>
<form class="navbar-form pull-right search-box" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="srch-term" id="srch-term">
<div class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
bootstrap documentation