1

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

在此处输入图像描述

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

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

1 回答 1

2

If you have tag and content in a single line it produces no padding. Make sure you anchor looks something like:

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

Or using link_to

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

Though it seems strange but

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

produces no spaces between icon and text

bootply

于 2014-02-12T00:54:18.600 回答