Search code examples
cssgrailsfont-facegsp

Font not applied in my web application


I am working on grails web application in which I am trying to apply a font named open sans but it is not applied in my web application. The procedure which I have followed is:

I have put the code below in me extended.css file

@font-face {
    src: url('../../images/font/openSans.woff');
    font-family: 'open sans';
    /*url('openSans.woff') format('woff'),*/
    font-style: normal;
    font-weight: normal;
}

body{
    font-family: 'open sans';
}

What am I missing?


Solution

  • Open Sans is a Google font, you can use it in you application as described in the link.

    Add following to your view or layout

    <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
    

    The Google Fonts API will generate the necessary browser-specific CSS to use the fonts. All you need to do is add the font name to your CSS styles. For example:

    font-family: 'Open Sans', sans-serif;
    

    See example here.