kier kier - 1 year ago 125
CSS Question

linear gradient css not working with navbar in bootstrap

I'm using a bootstrap 3 in my project and I have this navbar navbar-inverse. The background color of the navbar is black because it's inverse. What I want to do is to change the background color of that navbar. I've tried this code but it isn't working.


<div class="container-fluid">
<div class="navbar navbar-inverse navbar-static-top">
<div class="container">
<div class="navbar-header">
<a href="#" class="navbar-brand">Land Tenure Services</a>
<button class="navbar-toggle" data-toggle="collapse" data-target=".navHeaderCollapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>


.navbar-inverse {
margin-bottom: 0px;
-webkit-box-shadow: 0 8px 30px -6px black;
-moz-box-shadow: 0 8px 30px -6px black;
box-shadow: 0 8px 30px -6px black;
background: -moz-linear-gradient(center top, #2ebf16, #217812);
background: -webkit-gradient(linear, left top, left bottom, from(#2ebf16), to(#217812));
background: -o-linear-gradient(top, #2ebf16, #217812);
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#2ebf16', EndColorStr='#217812');

.navbar-inverse .container {
width: 100%;
padding: 0;

Answer Source

You forgot to include the non-prefixed version in your CSS rule (as the last one)

background: linear-gradient(center top, #2ebf16, #217812);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download