Search code examples
cssruby-on-railsfontsruby-on-rails-2

@font-face in rails 2.3.8


hi does anybody know how to include at font space and the font in the rails application .. i am using rails 2.3.8

i placed my font folder in public folder and my css is given below.. but its not working can anybody help me out.

my 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;
        }

view page

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

Solution

  • try by uploading the font into your server and try like this code

    <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>