我在我的项目中使用了bootstrap 3,我有这个navbar navbar-inverse。导航栏的背景颜色为黑色,因为它是反色的。我想要做的是更改该导航栏的背景颜色。我已尝试过此代码,但它无法正常工作。
.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;
}

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<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>
</button>
</div>
&#13;
答案 0 :(得分:0)
您忘记在CSS规则中包含非前缀版本(作为最后一个版本)
background: linear-gradient(center top, #2ebf16, #217812);