嗨,有人知道如何在Rails应用程序中包含字体空间和字体吗..我正在使用Rails 2.3.8

我将字体文件夹放在公用文件夹中
我的css在下面给出..但是它不起作用可以有人帮我。

我的CSS

 @font-face {
            font-family: 'Conv_code128';
            src: url('fonts/code128.eot');
            src: local('☺'), url('fonts/code128.woff') format('woff'), url('fonts/code128.ttf') format('truetype'), url('fonts/code128.svg') format('svg');
            font-weight: normal;
            font-style: normal;
        }


查看页面

<div style= "  float: left;
          font-family: 'Conv_code128';
          font-size: 25px;
          margin-left: 50px;">
    <%= hai %>
  </div>

最佳答案

尝试通过将字体上载到服务器中,然后尝试像这样的代码

<style type="text/css">
@font-face {
    font-family: "My Custom Font";
    src: url(http://www.example.org/mycustomfont.ttf) format("truetype");
}
p.customfont {
    font-family: "My Custom Font", Verdana, Tahoma;
}
</style>
<p class="customfont">Hello world!</p>

10-08 02:52