Answer the question
In order to leave comments, you need to log in
How to style Yii2 menu widget?
Hello! I can’t catch up with how this is done in Yii2, many properties have been removed from Yii1,
how to implement such a menu? :
<ul class="nav navbar-nav width-sto">
<li class="active"><a href="/index.html">Главная</a></li>
<li class="dropdown">
<a class="dropdown-toggle" href="/apple.html">Apple<b class="caret"></b></a>
<ul role="menu" class="dropdown-menu">
<li><a href="/iphone.html">iPhone</a></li>
<li><a href="/ipad.html">iPad</a></li>
<li><a href="/macbook-i-imac.html">Macbook и iMac</a></li>
<li><a href="/ipod-touch.html">iPod Touch</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="/samsung.html">Samsung<b class="caret"></b></a>
<ul role="menu" class="dropdown-menu">
<li><a href="/smartphones-samsung.html">Смартфоны</a></li>
<li><a href="/tablets-samsung.html">Планшеты</a></li>
</ul>
</li>
<li><a href="/price.html">Прайс-лист</a></li>
<li><a href="/contacts.html">Контакты</a></li>
</ul>
echo \yii\widgets\Menu::widget([
'items' => MenuModel::getItemsByMenuId(1),
'options'=>[
'class' => 'nav navbar-nav width-sto'
],
'activateParents'=>true,
'activeCssClass'=>'active',
]);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question