[英]Yii2 use different navbar background color for test and production installations
[英]How to change the Navbar color in Yii2
我需要在Yii2中更改導航欄的顏色(我在其中有“主頁”,“關於” ...),該怎么做? 我不想更改主題。
這是站點的css文件:
html,
body {
height: 100%;
}
.wrap {
min-height: 100%;
height: auto;
margin: 0 auto -60px;
padding: 0 0 60px;
}
.wrap > .container {
padding: 70px 15px 20px;
}
.footer {
height: 60px;
background-color: #B0C4DE;
border-top: 1px solid #ddd;
padding-top: 20px;
}
.jumbotron {
text-align: center;
background-color: transparent;
}
.jumbotron .btn {
font-size: 21px;
padding: 14px 24px;
}
.not-set {
color: #c55;
font-style: italic;
}
/* add sorting icons to gridview sort links */
a.asc:after, a.desc:after {
position: relative;
top: 1px;
display: inline-block;
font-family: 'Glyphicons Halflings';
font-style: normal;
font-weight: normal;
line-height: 1;
padding-left: 5px;
}
a.asc:after {
content: /*"\e113"*/ "\e151";
}
a.desc:after {
content: /*"\e114"*/ "\e152";
}
.sort-numerical a.asc:after {
content: "\e153";
}
.sort-numerical a.desc:after {
content: "\e154";
}
.sort-ordinal a.asc:after {
content: "\e155";
}
.sort-ordinal a.desc:after {
content: "\e156";
}
.grid-view th {
white-space: nowrap;
}
.hint-block {
display: block;
margin-top: 5px;
color: #999;
}
.error-summary {
color: #a94442;
background: #fdf7f7;
border-left: 3px solid #eed3d7;
padding: 10px 20px;
margin: 0 0 15px 0;
}
這是站點視圖(index.php):
<?php
/* @var $this yii\web\View */
$this->title = 'ACME Database';
?>
<div class="site-index">
<div class="jumbotron">
<h1>Welcome to ACME Database!</h1>
</div>
<div class="body-content">
....
但我不知道導航欄的配置位置。 我嘗試編輯所有bootstrap.css文件(navbar),但未做任何更改。
如果您查看布局文件,則會看到:
NavBar::begin([
...
'options' => [
'class' => 'navbar-inverse navbar-fixed-top',
],
]);
...
如果刪除navbar-inverse
則navbar的bg-color變為白色。 如果您想將顏色更改為其他顏色,可以在navbar-inverse
所在的位置添加my-navbar
並添加
.my-navbar {
background-color: #yourcolor;
}
不要更改引導文件,只需在自己的CSS中添加甚至覆蓋即可。
編輯
提示:如果您使用chrome開發人員工具欄(或類似工具),則只需將元素懸停並查看為其設置樣式的類,然后在自己的CSS中覆蓋該類。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.