2014-02-12 86 views
1

我在导轨应用程序中使用glyphicons导航栏。我似乎无法设置字形和链接标签之间的间距,除非我在标签前面放置了一个“”。BS3图形填充

enter image description here

任何人都可以提出一个更好的解决方案。谢谢!

<li> 
     <%= link_to "Maintenance", dashboards_path, :class=> "glyphicon glyphicon-wrench" %> 
    </li> 

回答

2

如果您在一行中包含标记和内容,则不会产生填充。 请务必锚看​​起来像:

<li> 
    <a href="#" class="glyphicon glyphicon-wrench"> 
    Maintenance 
    </a> 
</li> 

或者使用link_to

<li> 
    <%= link_to dashboards_path, class: 'glyphicon glyphicon-wrench' do %> 
    <span>Maintenance</span> 
    <% end %> 
</li> 

虽然它似乎很奇怪,但

<a href="#" class="glyphicon glyphicon-wrench">Maintenance</a>

产生图标和文本

之间没有空格

bootply

+0

谢谢bootply,你能分享如何使用link_to做这项工作吗?谢谢 – jared

+0

刚刚用'link_to'编辑了这个答案。你必须用任何html标签来包装文本。我在这里使用了'span'。 – Muntasim