Monday, March 5, 2012

use a .ttf or .otf font within CSS with @font-face

I stole the following from here:

@font-face {

   font-family: Delicious;

   src: url('Delicious-Roman.otf');

}

@font-face {

   font-family: Delicious;

   font-weight: bold;

   src: url('Delicious-Bold.otf');

}

 
 

After the styles are declared, one may use them like so elsewhere in a stylesheet:

h3 { font-family: Delicious, sans-serif; }

 
 

In HTML:

<h3>Hello <strong>World<\strong><\h3>

 
 

http://www.fontsquirrel.com/fontface/generator is a generator for @font-face.

No comments:

Post a Comment