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 */
}
Related
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>
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 just finished styling a menu, but I want it to all merge into a mobile style menu on a mobile device. The site is here.
Here is the HTML for the menu:
<div class="masthead clearfix">
<div class="inner">
<h3 class="masthead-brand">ONLY AT LSA</h3>
<nav>
<ul class="nav masthead-nav">
<li class="active">The Experience</li>
<li>Recent News</li>
<li>Gallery</li>
</ul>
</nav>
</div>
</div>
Here is the CSS for the menu:
.masthead-brand {
margin-top: 10px;
margin-bottom: 10px;
}
.masthead-nav > li {
display: inline-block;
}
.masthead-nav > li + li {
margin-left: 20px;
}
.masthead-nav > li > a {
padding-right: 0;
padding-left: 0;
font-size: 16px;
font-weight: bold;
color: #fff; /* IE8 proofing */
color: rgba(255,255,255,.75);
border-bottom: 2px solid transparent;
}
.masthead-nav > li > a:hover,
.masthead-nav > li > a:focus {
background-color: transparent;
border-bottom-color: #a9a9a9;
border-bottom-color: rgba(255,255,255,.25);
}
.masthead-nav > .active > a,
.masthead-nav > .active > a:hover,
.masthead-nav > .active > a:focus {
color: #fff;
border-bottom-color: #fff;
}
So I want it to go from this to your ideal mobile navigation system with the icon that you click and it expands the menu.
You should use CSS
/* All Mobile Sizes */
#media only screen and (max-width: 767px) { ... }
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);
}
I have a problem of alignment with my navbar build using Bootstrap3.
This is my navbar when it is not collapsed:
This is when it is collapsed (viewport under 1000px):
I want to stack up all the elements, as for example:
Gassero / -11.8810 (on his right)
Ordinare
Paniere
Conto
[img] Ciao
This is a bootply of the code:
This is my nav code:
<nav class="userbar" role="navigation">
<div class="logo">
<img src="img/befair.png" alt="..." class="imglogo">
</div>
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navhead">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-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 class="brandname">GASISTAFELICE</div>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<div class="navbar-left">
<ul ng-controller="gas_controller" class="optionlist nav navbar-nav">
<li ng-repeat="gasname in gasnames"
ng-class="{ 'active': $index == selectedIndex }"
ng-click="itemClicked($index)">
<a href="#/{{peID}}/" ng-click="getID(gasname.id);">
{{gasname.name}}
</a>
<div class="gaslabel">{{gasname.balance}}€</div>
</li>
</ul>
<ul class="optionlist nav navbar-nav" ng-controller="menu_controller">
<li markable>
<a href="#/{{peID}}/">
<i class="fa fa-book"></i>Ordinare
</a>
</li>
<li markable>
<a href="#/{{peID}}/paniere">
<i class="fa fa-shopping-cart"></i>Paniere
</a>
</li>
<li markable>
<a href="#/{{peID}}/conto">
<i class="fa fa-user"></i>Conto
</a>
</li>
</ul>
</div>
<div class="navbar-right">
<a class="navpic" href="#/{{peID}}/scheda"><img src="img/user_pic.png" alt="..." class="imgpic"></a>
<a class="titlenav" href="#/{{peID}}/scheda">Ciao {{name}}</a>
</div>
</div><!-- /.navbar-collapse -->
</nav>
And this is my LESS/CSS:
.userbar {
position: relative;
min-height: 50px;
margin-bottom: 20px;
border: 1px solid transparent;
background-color: #f8f8f8;
border-color: #e7e7e7;
}
.userbar:before,
.userbar:after {
content: " ";
display: table;
}
.userbar:after {
clear: both;
}
.userbar:before,
.userbar:after {
content: " ";
display: table;
}
.userbar:after {
clear: both;
}
#media (min-width: 1000px) {
.userbar {
border-radius: 4px;
}
}
.userbar .navbar-brand {
color: #777777;
}
.userbar .navbar-brand:hover,
.userbar .navbar-brand:focus {
color: #5e5e5e;
background-color: transparent;
}
.userbar .navbar-text {
color: #777777;
}
.userbar .navbar-nav > li > a {
color: #777777;
}
.userbar .navbar-nav > li > a:hover,
.userbar .navbar-nav > li > a:focus {
color: #333333;
background-color: transparent;
}
.userbar .navbar-nav > .active > a,
.userbar .navbar-nav > .active > a:hover,
.userbar .navbar-nav > .active > a:focus {
color: #555555;
background-color: #e7e7e7;
}
.userbar .navbar-nav > .disabled > a,
.userbar .navbar-nav > .disabled > a:hover,
.userbar .navbar-nav > .disabled > a:focus {
color: #cccccc;
background-color: transparent;
}
.userbar .navbar-toggle {
border-color: #dddddd;
}
.userbar .navbar-toggle:hover,
.userbar .navbar-toggle:focus {
background-color: #dddddd;
}
.userbar .navbar-toggle .icon-bar {
background-color: #cccccc;
}
.userbar .navbar-collapse,
.userbar .navbar-form {
border-color: #e7e7e7;
}
.userbar .navbar-nav > .open > a,
.userbar .navbar-nav > .open > a:hover,
.userbar .navbar-nav > .open > a:focus {
background-color: #e7e7e7;
color: #555555;
}
#media (max-width: 999px) {
.userbar .navbar-nav .open .dropdown-menu > li > a {
color: #777777;
}
.userbar .navbar-nav .open .dropdown-menu > li > a:hover,
.userbar .navbar-nav .open .dropdown-menu > li > a:focus {
color: #333333;
background-color: transparent;
}
.userbar .navbar-nav .open .dropdown-menu > .active > a,
.userbar .navbar-nav .open .dropdown-menu > .active > a:hover,
.userbar .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #555555;
background-color: #e7e7e7;
}
.userbar .navbar-nav .open .dropdown-menu > .disabled > a,
.userbar .navbar-nav .open .dropdown-menu > .disabled > a:hover,
.userbar .navbar-nav .open .dropdown-menu > .disabled > a:focus {
color: #cccccc;
background-color: transparent;
}
}
.userbar .navbar-link {
color: #777777;
}
.userbar .navbar-link:hover {
color: #333333;
}
.navhead:before,
.navhead:after {
content: " ";
display: table;
}
.navhead:after {
clear: both;
}
.navhead:before,
.navhead:after {
content: " ";
display: table;
}
.navhead:after {
clear: both;
}
#media (min-width: 1000px) {
.navhead {
float: left;
}
}
.titlenav {
float: left;
padding: 15px 15px;
font-size: 18px;
line-height: 20px;
}
.titlenav:hover,
.titlenav:focus {
text-decoration: none;
}
#media (min-width: 1000px) {
.navbar > .container .titlenav {
margin-left: -15px;
}
}
.collapsebar {
display: none;
max-height: 340px;
overflow-x: visible;
padding-right: 15px;
padding-left: 15px;
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
-webkit-overflow-scrolling: touch;
}
.collapsebar.in {
display: block;
}
.collapsebar:before,
.collapsebar:after {
content: " ";
display: table;
}
.collapsebar:after {
clear: both;
}
.collapsebar:before,
.collapsebar:after {
content: " ";
display: table;
}
.collapsebar:after {
clear: both;
}
.collapsebar.in {
overflow-y: auto;
}
#media (min-width: 1000px) {
.collapsebar {
width: auto;
border-top: 0;
box-shadow: none;
}
.collapsebar.collapse {
display: block !important;
height: auto !important;
padding-bottom: 0;
overflow: visible !important;
}
.collapsebar.in {
overflow-y: visible;
}
.navbar-fixed-top .collapsebar,
.navbar-static-top .collapsebar,
.navbar-fixed-bottom .collapsebar {
padding-left: 0;
padding-right: 0;
}
}
#media (min-width: 1000px) {
.navbar-left {
float: left !important;
}
.navbar-right {
float: right !important;
}
}
.navbar-left {
text-align: center;
}
.optionlist {
margin-bottom: 0;
padding-left: 0;
list-style: none;
margin: 7.5px -15px;
float: left!important;
}
.optionlist:before,
.optionlist:after {
content: " ";
display: table;
}
.optionlist:after {
clear: both;
}
.optionlist:before,
.optionlist:after {
content: " ";
display: table;
}
.optionlist:after {
clear: both;
}
.optionlist > li {
position: relative;
display: block;
}
.optionlist > li > a {
position: relative;
display: block;
padding: 10px 15px;
}
.optionlist > li > a:hover,
.optionlist > li > a:focus {
text-decoration: none;
background-color: #eeeeee;
}
.optionlist > li.disabled > a {
color: #999999;
}
.optionlist > li.disabled > a:hover,
.optionlist > li.disabled > a:focus {
color: #999999;
text-decoration: none;
background-color: transparent;
cursor: not-allowed;
}
.optionlist .open > a,
.optionlist .open > a:hover,
.optionlist .open > a:focus {
background-color: #eeeeee;
border-color: #428bca;
}
.optionlist .nav-divider {
height: 1px;
margin: 9px 0;
overflow: hidden;
background-color: #e5e5e5;
}
.optionlist > li > a > img {
max-width: none;
}
.optionlist > li > a {
padding-top: 10px;
padding-bottom: 10px;
line-height: 20px;
}
#media (max-width: 999px) {
.optionlist .open .dropdown-menu {
position: static;
float: none;
width: auto;
margin-top: 0;
background-color: transparent;
border: 0;
box-shadow: none;
}
.optionlist .open .dropdown-menu > li > a,
.optionlist .open .dropdown-menu .dropdown-header {
padding: 5px 15px 5px 25px;
}
.optionlist .open .dropdown-menu > li > a {
line-height: 20px;
}
.optionlist .open .dropdown-menu > li > a:hover,
.optionlist .open .dropdown-menu > li > a:focus {
background-image: none;
}
}
#media (min-width: 1000px) {
.optionlist {
float: left;
margin: 0;
}
.optionlist > li {
float: left;
}
.optionlist > li > a {
padding-top: 15px;
padding-bottom: 15px;
}
.optionlist.navbar-right:last-child {
margin-right: -15px;
}
}
.optionlist > li > a {
padding-bottom: 27px;
}
}
#media (min-width: 1000px) {
.navbar-toggle {
display: none;
}
}
.navbar-nav {
margin: 7.5px -15px;
}
.navbar-nav > li > a {
padding-top: 10px;
padding-bottom: 10px;
line-height: 20px;
}
#media (max-width: 999px) {
.navbar-nav .open .dropdown-menu {
position: static;
float: none;
width: auto;
margin-top: 0;
background-color: transparent;
border: 0;
box-shadow: none;
}
.navbar-nav .open .dropdown-menu > li > a,
.navbar-nav .open .dropdown-menu .dropdown-header {
padding: 5px 15px 5px 25px;
}
.navbar-nav .open .dropdown-menu > li > a {
line-height: 20px;
}
.navbar-nav .open .dropdown-menu > li > a:hover,
.navbar-nav .open .dropdown-menu > li > a:focus {
background-image: none;
}
}
#media (min-width: 1000px) {
.navbar-nav {
float: left;
margin: 0;
}
.navbar-nav > li {
float: left;
}
.navbar-nav > li > a {
padding-top: 15px;
padding-bottom: 15px;
}
.navbar-nav.navbar-right:last-child {
margin-right: -15px;
}
}
.nav {
margin-bottom: 0;
padding-left: 0;
list-style: none;
}
.nav:before,
.nav:after {
content: " ";
display: table;
}
.nav:after {
clear: both;
}
.nav:before,
.nav:after {
content: " ";
display: table;
}
.nav:after {
clear: both;
}
.nav > li {
position: relative;
display: block;
}
.nav > li > a {
position: relative;
display: block;
padding: 10px 15px;
}
.nav > li > a:hover,
.nav > li > a:focus {
text-decoration: none;
background-color: #eeeeee;
}
.nav > li.disabled > a {
color: #999999;
}
.nav > li.disabled > a:hover,
.nav > li.disabled > a:focus {
color: #999999;
text-decoration: none;
background-color: transparent;
cursor: not-allowed;
}
.nav .open > a,
.nav .open > a:hover,
.nav .open > a:focus {
background-color: #eeeeee;
border-color: #428bca;
}
.nav .nav-divider {
height: 1px;
margin: 9px 0;
overflow: hidden;
background-color: #e5e5e5;
}
.nav > li > a > img {
max-width: none;
}
.userbar{
//aggiungere stile navbar
.navbar;
.navbar-default; //taken both from Bootstrap
}
.navhead{
.navbar-header; //taken from Bootstrap
}
.brandname{
margin-top:10px;
margin-right:10px;
margin-left:5px;
}
.collapsebar{
.collapse;
.navbar-collapse;
}
.navbar-left{
text-align:center;
}
.optionlist{
.nav;
.navbar-nav;
float:left!important;
}
.gaslabel{
position: absolute;
width:100%;
color: #gas-color;
}
.navbar-right{
margin-top:5px;
}
You need to move the nave link into a single ul element then use css for further alignment and finishing.
http://www.bootply.com/tsf41Uxykt#
<ul class="optionlist nav navbar-nav" ng-controller="menu_controller">
<li ng-controller="gas_controller" ng-repeat="gasname in gasnames" ng-class="{ 'active': $index == selectedIndex }" ng-click="itemClicked($index)">
<a href="#/{{peID}}/" ng-click="getID(gasname.id);">
gasname
</a>
<div class="gaslabel">110100</div>
</li>
<li markable="">
<a href="#/{{peID}}/">
<i class="fa fa-book"></i>Ordinare
</a>
</li>
<li markable="">
<a href="#/{{peID}}/paniere">
<i class="fa fa-shopping-cart"></i>Paniere
</a>
</li>
<li markable="">
<a href="#/{{peID}}/conto">
<i class="fa fa-user"></i>Conto
</a>
</li>
<li>
<div class="navbar-right">
<a class="navpic" href="#/{{peID}}/scheda"><img src="img/user_pic.png" alt="..." class="imgpic"></a>
<a class="titlenav" href="#/{{peID}}/scheda">Ciao {{name}}</a>
</div>
</li>
</ul>