在按钮中添加Twitter Bootstrap图标 [英] Add twitter bootstrap icon in button
本文介绍了在按钮中添加Twitter Bootstrap图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在twitter引导程序中有一个底部,但想在底部添加一个图标.有可能吗?
I have a bottom in twitter bootstrap but want to add a icon in the bottom. Is that possible ?
这是按钮:
<div class="col-md-6">{{ HTML::linkRoute('change_log', 'Endringslogg', array(), array('class' => 'btn btn-primary')) }}</div>
我要添加的图标:
<span class="glyphicon glyphicon-user"></span>
推荐答案
您可以创建一个宏来处理此问题
You can create a macro to handle this
HTML::macro('button', function($route, $title, $parameters = array(), $attributes = array())
{
$icon = array_get($attributes, 'icon');
$iconTag = $icon ? '<span class="glyphicon glyphicon-'.$icon.'"></span> ' : '';
if ($icon) unset($attributes['icon']);
return HTML::linkRoute($route, $iconTag.$title, $parameters, $attributes);
});
然后在刀片服务器模板中执行以下操作:
Then in your blade template do something like:
<div class="col-md-6">{{ HTML::button('change_log', 'Endringslogg', [], ['class' => 'btn btn-primary', 'icon' => 'user']) }}</div>
这篇关于在按钮中添加Twitter Bootstrap图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文