Yii2 如何将图标移动到中心
我有导航栏,代码如下Yii2 如何将图标移动到中心,yii2,navbar,Yii2,Navbar,我有导航栏,代码如下 <?php NavBar::begin(['brandLabel' => '', 'options' => [ //'class' => 'navbar-inverse navbar-fixed-top', 'style' => 'height: 30px; margin-top:-10px;',]
<?php
NavBar::begin(['brandLabel' => '',
'options' => [ //'class' => 'navbar-inverse navbar-fixed-top',
'style' => 'height: 30px; margin-top:-10px;',]
]);
echo Nav::widget([
'items' => [['label' => 'Home', 'url' => ['/site/index']],
['label' => 'About', 'url' => ['/site/about']],],
'options' => ['class' => 'navbar-nav','style' => 'align:center',],
]);
NavBar::end();
?>
是否可以将中堂图标移到中心?。。
引导导航栏左侧,导航栏右侧正常工作。这一个应该可以工作,最好将内联css移动到某个类
NavBar::begin(['brandLabel' => '',
'options' => [ //'class' => 'navbar-inverse navbar-fixed-top',
'style' => 'height: 30px; margin-top:-10px;',]
]);
echo Nav::widget([
'items' => [['label' => 'Home', 'url' => ['/site/index']],
['label' => 'About', 'url' => ['/site/about']],],
'options' => ['class' => 'navbar-nav','style' => 'display: flex;justify-content: center;float: none;',],
]);
NavBar::end();
您可以在菜单中添加自己的ID
<?php
NavBar::begin(['brandLabel' => '',
'options' => [
'class' => 'navbar navbar-fixed-top clients',
'id' => 'my-menu',
],
]);
echo Nav::widget([
'items' => [['label' => 'Home', 'url' => ['/site/index']],
['label' => 'About', 'url' => ['/site/about']],],
'options' => ['class' => 'navbar-nav', 'style' => 'align:center',],
]);
NavBar::end();
?>
div#my-menu-collapse ul li {
text-align: center;
margin: 0 auto;
}