如何在Yii2 NavBar中添加TOOLTIP

时间:2016-01-17 11:05:12

标签: twitter-bootstrap yii2 twitter-bootstrap-tooltip

我已经尝试过各个网站,各地论坛的人们提出的很多建议。 (Activating Tooltip)但我仍然没有成功。我在我自己的布局文件中添加了这个编码。 观看/布局

NavBar小部件编码

.tooltipStyle + .tooltip > .tooltip-inner {
background-color: #000;
}
.tooltipStyle + .tooltip > .tooltip-arrow { 
    border-bottom-color:#ff0; 
}

CSS

wx.EVT_LIST_BEGIN_DRAG

最终我只想得到像这样的输出

enter image description here

对我的编码做了一些修改后,显示了这个输出。

enter image description here

1 个答案:

答案 0 :(得分:3)

您可以将标题添加到span中的标签......这样

'items' => [  
        [
          'label' => '<span style="font-size:1.3em;" 
                   class="glyphicon glyphicon-cog"</span>'
            . '  Control Panel', 
          'options' =>[ 'data-toggle' => 'tooltip',  
                        'data-placement' => 'tooltip',
                         'title' =>'Notifications', 
                          'class' => 'myTooltipClass']
          'url' => ['/site/controlPanel'],
          'data-toggle' => 'tooltip',
          'title' => 'Control Panel',
        ],

在你的CSS中添加这个类(例如:用于改变颜色)

.myTooltipClass + .tooltip > .tooltip-inner {background-color: #ff0;}
.myTooltipClass + .tooltip > .tooltip-arrow { border-bottom-color:#ff0; }