【问题标题】:Icon font in Rails App not loadingRails App中的图标字体未加载
【发布时间】:2013-02-05 19:17:28
【问题描述】:
【问题讨论】:
标签:
ruby-on-rails-3
icons
font-face
【解决方案1】:
我也一直在这些方面苦苦挣扎,并且有以下工作
- 在资产/字体中放置 fontawesome-webfont.eot、ttf 和 woff 文件
-
在您的 css 文件中放入以下代码(将 iconmoon 替换为 fontawesome
@font-face {
font-family: 'icomoon';
src:url('fonts/icomoon.eot');
src:url('fonts/icomoon.eot?#iefix') format('embedded-opentype'),
url('fonts/icomoon.woff') format('woff'),
url('fonts/icomoon.ttf') format('truetype'),
url('fonts/icomoon.svg#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
[数据图标]:之前 {
字体系列:'icomoon';
内容:attr(数据图标);
说话:无;
字体粗细:正常;
字体大小:16px;
行高:16px;
行高:1;
-webkit-font-smoothing:抗锯齿;
}
在您的 erb 中使用以下内容,将 xe04b 替换为您要使用的图像
<div class="fs1" aria-hidden="true" data-icon=""></div>
希望有帮助吗?