简体   繁体   English

在菜单选项卡上添加字体真棒图标

[英]Adding a font awesome icon on a Menu Tab

I have the following code: 我有以下代码:

<?php $this ->widget('application.extensions.mbmenu.MbMenu',array(
    'items'=>array(
         array('label'=>'Home','url'=>array('/site/index')),

..... .....

I am trying to bring in font-awesome icon and place it next to the Home label. 我正在尝试引入超棒的字体图标并将其放置在“首页”标签旁边。 Something like this. 这样的事情。 I am not sure exactly how to write code so that php welcomes font awesome icon. 我不确定确切如何编写代码,以便php欢迎字体真棒图标。 Thank you for all help. 感谢您的所有帮助。 It is greatly appreciated. 非常感谢。

array('label'=>'Home<icon-fa-home icon-3x>')

First, make sure you import fontawesome css and font files inside your layout. 首先,请确保在布局中导入fontawesome CSS和字体文件。 Next, you can do this in your code: 接下来,您可以在代码中执行此操作:

array('label'=>'Home <span class="fa fa-home fa-3x"></span>');

Or 要么

array('label'=>'Home <i class="fa fa-home fa-3x"></i>');

Here is more information about fontawesome. 是有关fontawesome的更多信息。

Hmmm... Strange why method descriibed by @hamed not working. 嗯...奇怪,为什么@hamed描述的方法不起作用。 Try add this paramter to item: 尝试将此参数添加到项目:

'itemOptions' => array('class'=>'fa fa-home fa-3x'),

This should add classes to link. 这应该添加要链接的类。 If it will works that mean something wrong with creating custom menu wiget. 如果可以正常工作,则表示创建自定义菜单小工具时出现了问题。 But it realy strange because: 但这确实很奇怪,因为:

array('label'=>'Home <i class="fa fa-home fa-3x"></i>');

should work. 应该管用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM