Search

28 March, 2018

How to import and use a font in your website ?



Most people like to use the default available list of fonts . But what if we liked some other font and we want to use it our own website .

There are free downloadable fonts on the web. When you download a zip of it , you generally would receive files of the format 'ttf', 'otf' etc. You can visit the site https://www.fontsquirrel.com and convert them into a format 'woff' .


Now to us the font. Create a folder 'fonts' inside your 'css' folder . Place all woff files inside this folder .

Now the css . You can create a style like this :


@font-face {

    font-family: 'homizio_novaregular';

    src: url('regular-webfont.woff2') format('woff2'),

         url('regular-webfont.woff') format('woff');

    font-weight: normal;

    font-style: normal;



}


.special {

margin: 0; 

padding: 0;

font-family:'homizio_novaregular', Georgia;

 border: solid black 2px;

 border-radius: 2px;

 padding: 10px;

 margin: 10px;



}

I applied this to the whole body of my test site.


<body class="special">

That's it . 

No comments:

Post a Comment