Hello guys,
In my previous project written in Yii 1.1x
I used following code to make a link in my boostrap navigation bar active
$this->menu = array(
array('label' => 'Menu'),
array('label' => 'Profile', 'url' => '#', 'active' => true)
);
Now in my Yii2 project, bootstrap 3, this approach doesn’t work.
Can anyone suggest how can I make a link active in navigation bar?
I use following code in my column1.php layout file to render navigation bar
<div>
<?php
echo \yii\bootstrap\Nav::widget([
'items' => $this->menu,
]);
?>
</div>
Thanks in advance.
Pasman
(Pasman P)
2
try SideNav, "active" attribute works.
mynzhassar
(Marlen 777)
3
Thanks for suggestion I will try it out.
Pasman
(Pasman P)
4
Looks like site.css not contain "active" class.
try to add this code:
.nav li.active a, .nav li.active a:hover {
background-color: #08D;
color: white;
}
Such a shame since solution was so simple, thanks very much!
Next time I need to be more careful