【问题标题】:How to show a twitter bootstrap icon in RoR?如何在 RoR 中显示 twitter 引导图标?
【发布时间】:2013-01-22 01:41:00
【问题描述】:

如果我尝试使用引导程序的图标类,它不会正确显示。
有人知道怎么显示吗?

<%= f.submit nil, :class => 'btn btn-primary', :value => sanitize('<i class="icon-plus icon-white"></i> ') +  'Create!' if @community.new_record? %>

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 twitter-bootstrap


    【解决方案1】:

    glyphicon-halflings-white.png(用于白色图标)必须位于 Rails 应用程序的 app/assets/images 目录中。然后将&lt;i class="icon-plus icon-white"&gt;&lt;/i&gt; 添加到您想要的视图中。

    要将图标用作表单提交按钮,请将块传递给button_tag

    <%= button_tag(type: 'submit', class: "btn btn-primary") do %>
      <i class="icon-ok icon-white"></i>
    <% end %>
    

    来源:

    【讨论】:

    猜你喜欢
    • 2012-06-12
    • 1970-01-01
    • 2013-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-12
    • 2014-06-12
    • 1970-01-01
    相关资源
    最近更新 更多