I am going to change color and another css in my bootstrap navbar-inverse. Default color is black, and I want to change it in dark blue.
My code, I guess, is correct, but unfortunately, nothing had changed.
.navbar {
font-size: 16px;
font-weight: 100;
}
li {
margin: 5px 0px 5px 0px;
font-size: 14px;
font-weight: 300;
}
.menu {
padding: 0px;
}
.navbar {
border-radius: 0px;
margin-bottom: 0px;
}
.navbar-inverse {
background-color: #1b365b;
border: none;
}
.navbar-brand {
padding: 5px 15px;
}
.navbar-inverse .navbar-toggle {
border-color: #fff;
}
.navbar-inverse .navbar-toggle .icon-bar {
background-color: #fff;
}
.navbar-inverse .navbar-nav>.active>a,
.navbar-inverse .navbar-nav>.active>a:hover,
.navbar-inverse .navbar-nav>.active>a:focus {
background-color: #254a7c;
}
<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>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<header>
<nav class="navbar-001 navbar navbar-inverse">
<div class="container menu-001">
<div class="row">
<div class="col-xs-12">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"><img src="img/logo.png" alt="logo"></a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right">
<li class="active">О компании</li>
<li>Прайс</li>
<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Услуги <span class="caret"></span></a>
<ul class="dropdown-menu">
<li>Грузоперевозки</li>
<li>Аренда автотранспорта</li>
<li>Аренда спецтехники</li>
<li>Ремонт автотранспорта</li>
<li>Грузовой шиномонтаж</li>
<li>Вывоз мусора</li>
<li>Продажа топлива</li>
<li>Аренда земли</li>
<li>Страхование грузов</li>
</ul>
</li>
<li>Документы</li>
</ul>
</div>
</div>
</div>
</div>
</nav>
</header>
The bootstrap html code works correctly, but navbar css code doesn't work at all. But! css code that isn't related to navbar-inverse works perfectly.
Where is my mistake? What did I wrong?
.navbar-inverse {
background-color:#9933ff !important;
border:none;
}
you can write another css class for the navbar-inverse and write the background-color and put "!important" as it will overwrite the default navbar-inverse in bootstrap
try this code
bootstrap class conflict with your code
.navbar-001.navbar.navbar-inverse {
background-color:#1b365b;
border:none;
}
or
.navbar-001.navbar.navbar-inverse {
background-color:#1b365b!important;
border:none!important;
}
Related
Hey guys i have been trying to add my company logo to the bootstrap nav bar, and my logo is saved in Images/Logo.jpg in the same Directory as that of my index.html, But i just cant seem to add a logo to my nav bar, all i can see is my text for logo and no image. Please help me here is my code. Thanks
HTML
</head>
<body id="myPage" data-spy="scroll" data-target=".navbar" data-offset="60">
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" class="pull-left" href="#myPage">
<img src="Images/Logo.jpg">The Concetto</span>
</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right">
<li>ABOUT</li>
<li>SERVICES</li>
<li>CAREER</li>
<li>CONTACT</li>
</ul>
</div>
</div>
</nav>
CSS
.container1 {
display: flex;
justify-content: center;
}
.navbar {
margin-bottom: 0;
background-color: #f4511e;
z-index: 9999;
border: 0;
font-size: 12px !important;
line-height: 1.42857143 !important;
letter-spacing: 4px;
border-radius: 0;
font-family: Montserrat, sans-serif;
}
.navbar li a, .navbar .navbar-brand {
color: #fff !important;
}
.navbar-nav li a:hover, .navbar-nav li.active a {
color: #f4511e !important;
background-color: #fff !important;
.navbar-default .navbar-toggle {
border-color: transparent;
color: #fff !important;
}
I am creating a website using the latest version of bootstrap, I have a menu that when viewed on a mobile device changes to a toggle menu with the 3 little lines the same as a burger menu. I would like to be able to change the color of the lines as my header is white and so are the lines and they cannot be seen. I have google this but have no joy with changing the color.
Code:
.navbar-header, #myNavbar, .container-fluid {
background: #fff;
}
.nav.navbar-nav li a{
color: #66728d;
font-size: 18px;
background: transparent;
}
.navbar-brand img {
width:176px !important;
height:110px !important;
}
.nav.navbar-nav li a:hover {
background: #8d8166;
}
.navbar-header, #myNavbar, .container-fluid img {
padding-top: 0;
padding-bottom:5px;
}
.nav.navbar-nav li a {
color: #66728d;
background: transparent;
}
.navbar-toggle {
color: green;
}
<nav class="navbar navbar-inverse navbar-light bg-faded">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#home">
<img src="images/logo.JPG" alt="Los Angeles">
</a>
</div>
<div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li>Home</li>
<li>About Us</li>
<li>Specials</li>
<li>Links</li>
<li>Contact Us</li>
</ul>
</div>
</div>
</nav>
You can control the color of the 3 bars in the hamburger toggle button using this CSS:
.navbar .navbar-toggle .icon-bar {
background-color: #000;
}
The fixed navbar was working but suddenly it stopped on Firefox. When I tried on other browsers (chrome, ie, opera) it works right now but not on FF. I tried to start FF in safe mode but no difference. What is wrong?
.nav-tabs li a {
color: #777;
}
.navbar {
margin-bottom: 0;
background-color: #153870;
border: 0;
font-size: 15px !important;
letter-spacing: 4px;
opacity:0.9;
}
.navbar li a, .navbar .navbar-brand {
color: #ffef03 !important;
}
.navbar-nav li a:hover {
color: #3AA83D !important;
}
.navbar-nav li.active a {
color: #fff !important;
background-color:#29292c !important;
}
.navbar-default .navbar-toggle {
border-color: transparent;
}
.open .dropdown-toggle {
color: #ffef03 ;
background-color: #153870 !important;
}
.dropdown-menu li a {
color: #ffef03 !important;
}
.dropdown-menu li a:hover {
background-color: #153870 !important;
}
<nav id="myNB" class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavb">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Obrakadabra!..</a>
</div>
<div class="collapse navbar-collapse" id="myNavb">
<ul class="nav navbar-nav navbar-right">
<li>Askerleri</li>
<li>Koç Hakkında</li>
<li>Ne dediler?</li>
<li>O ne dedi?</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Dahası
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>Mekanı</li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
I'm currently working on a theme and there I got this weird sort of problem which I'm here sharing for solution, I want to change the bootstrap navbar color from default to #0288D1 but even though I have mentioned this hex-code in background-color property of navbar class I haven't got the desired result.
Here is the HTML Code
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#menu">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"></a>
</div>
<div class="collapse navbar-collapse" id="menu">
<ul class="nav navbar-nav navbar-right">
<li>ABOUT</li>
<li>SERVICES</li>
<li>PORTFOLIO</li>
<li>PRICING</li>
<li>CONTACT</li>
</ul>
</div>
</div>
CSS
.navbar {
margin-bottom: 0;
background-color: #0288D1;
z-index: 9999;
border: 0;
font-size: 12px !important;
line-height: 1.42857143 !important;
letter-spacing: 4px;
border-radius: 0;
}
.navbar li a, .navbar .navbar-brand {
color: #fff !important;
}
.navbar-nav li a:hover, .navbar-nav li.active a {
color: #0288D1 !important;
background-color: #fff !important;
}
.navbar-default .navbar-toggle {
border-color: transparent;
color: #fff !important;
}
You can replace it with w/e color you want.It works fine to me , I dont experience any problems? Even with hex-code color;
.navbar{
background-color: red;
}
I have been playing around with bootstrap so build me a small personal page where I have a navbar that looks like this:
<body>
<nav class="navbar navbar-default navbar-fixed-top navbar-shrink">
<div class="container">
<div class="navbar-header page-scroll">
<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="#home">Jon Snow</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li class="page-scroll">
About Me
</li>
<li class="page-scroll">
Work
</li>
<li class="page-scroll">
Blog
</li>
<li class="page-scroll">
Contact Me
</ul>
</div>
</div>
</nav>
</body>
And its styled as follows:
body {
background-color:#2c3e50;
}
.navbar-fixed-top.navbar-shrink {
color:white;
padding: 10px 0;
background: rgba(0, 0, 0, .1);
}
But I get a white line at the navbar that looks like this:
How do I remove the white line and change the colors of the items in the Navbar to white?
Here is a JS Fiddle.
Here are the rules you can apply to remove borders (on all viewports) and change the color of the li items.
See working example Snippet.
body,
html {
background: #2c3e50;
}
.navbar.navbar-default {
padding: 10px 0;
background: rgba(0, 0, 0, .1);
border: none;
}
.navbar.navbar-default .navbar-nav > li > a,
.navbar.navbar-default .navbar-brand {
color: white;
}
.navbar.navbar-default .navbar-collapse {
border: none;
box-shadow: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-default navbar-fixed-top navbar-shrink">
<div class="container">
<div class="navbar-header page-scroll">
<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="#home">Jon Snow</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li class="page-scroll">
About Me
</li>
<li class="page-scroll">
Work
</li>
<li class="page-scroll">
Blog
</li>
<li class="page-scroll">
Contact Me
</ul>
</div>
</div>
Just add this to your styling:
.navbar { border: none!important; }
Bootstrap nav has a default border.
And the color:
.navbar-default .navbar-nav li a { color: #fff; }
This guy right here:
.navbar-default {
border-color: #e7e7e7;
}
Change that to none or the same color as your background color. Should do the trick.
EDIT
Sorry, I missed the second part of your question. This should set your text color in the nav bar:
.navbar-default .navbar-nav>li>a {
color: #fff;
}
Then you'll need a hover rule (or any other state):
.navbar-default .navbar-nav>li>a {
color: red;
}
The line is caused by the following CSS in Bootstrap
.navbar-default {
background-color: #f8f8f8;
border-color: #e7e7e7;
}
Overwrite this border-color with any color or no color you want.
For this links change the color with this
.navbar-default .navbar-nav > li > a{
color:**your color** !important;
}
You can do the hover, active, focus and visited colors for the links like this
.navbar-default .navbar-nav > li > a:hover{color: **your color** !important;}
.navbar-default .navbar-nav > li > a:active{color: **your color** !important;}
.navbar-default .navbar-nav > li > a:focus{color: **your color** !important;}
.navbar-default .navbar-nav > li > a:visited{color: **your color** !important;}
Hope that helps!