[英]Glyphicons Pro icon not showing correctly in Rails 4.2/Bootstrap
在线购买Glyphicons后,我将带有Bootstrap(3.3.6)的glyphicons regular
Glyphicons集成到Rails 4.2应用程序中。 在此之前,其他人已经集成了glyphicon halfings
。
我所做的是将5个Glyphicon文件( svg, ttf, eot, woff, woff2
) glyphicons/web/bootstrap-example/fonts/
到glyphicons/web/bootstrap-example/fonts/
到assets/fonts/
。 也将plyphicons/web/bootstrap-example/css/glyphicons.css
到“ assets / stylesheets /”。
以下是Rails资产下的文件:
问题是glyphicon regular
中的图标未显示。
在application.css.scss
,添加@import glyphicons.css
问题是字形图标显示不正确。 这是草本编码:
<%= link_to '<i class="glyphicons glyphicons-eye-open"></i> Free Trial Now'.html_safe,... %>
它显示了一个在4个角带有char(无法读取)的框。 见下图:
我们的过程中缺少什么?
好吧,您应该做的第一件事是打开浏览器调试控制台(Chrome中的Ctrl + shift + i),并列出导致此错误的错误。
通常,第三方.css文件中总是有一些图像引用。 并且,当您集成这些文件时,您需要根据需要更改图像的url /路径。
尝试这样:
这是在链接中使用glyphicons的正确方法
<td><%= link_to edit_user_path(user) do %>
<i class="glyphicons glyphicons-eye-open" title='Edit'></i>
<% end %>
</td>
您需要做其他事情才能工作,
查看本教程: http : //www.erikminkel.com/2013/09/01/twitter-bootstrap-3-in-a-rails-4-application/
由于样式表位于Rails的/assets
下。 在glyphicon.css
, fonts
需要替换为assets
。 更改之后,glyphicon PRO开始工作!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.