Using CSS3 font-face To Add Custom Fonts To Your Website
March 12th, 2010
One of the biggest features in CSS3 is the ability to use custom fonts in your web designs. In this tutorial, I’ll show you how to do just that using the free font Aller Display. Once you have downloaded the file, upload it to your server and note the location.
Browser Support
Currently these styles are supported by Safari, Firefox, Chrome, and Opera.
Here’s What The CSS Looks Like
The first step is to setup the @font-face selector with the font you want to use. For this example, I’m using the free font Aller Display. The font-family property declares the name/value for your custom font. The src property is the link to the font file on your server, which you have already uploaded.
@font-face {
font-family: aller-display;
src: url('aller-display.ttf');
}
Now we’ll setup it up so every <div> in your document will use Aller Display. Make sure the font-family value matches the one you setup under the @font-face selector. In this case it is aller-display.
@font-face {
font-family: aller-display;
src: url('aller-display.ttf');
}
div {
font-family: aller-display;
font-size: 2em;
}
Adding the HTML
The last thing we need to do is add the HTML, which is pretty basic.
<div>this is a custom font named aller display</div>
Here’s What It Looks Like

A Word On Copyright
Make sure you check the license for a font before you use it. Many fonts are not currently licensed for web use. The safest policy is to just use free fonts. There’s a great collection over at dafont.com.
Support Files
That’s it, that’s all. Check out the live demo and download the source files below.
Print This Post
10 Comments on “Using CSS3 font-face To Add Custom Fonts To Your Website”
Max
how about aller? are we allowed to use this font for @font-face? thanks and keep it up!
May 14, 2010 » 10:59 am
CSS3 Typography and Special Effects | AEXT.NET MAGAZINE
[...] is honed with CSS3) to create the font you would like. An example of this is below, and provided by CARDEO. @font-face { font-family: aller-display; src: url('aller-display.ttf'); } div { [...]
July 8, 2010 » 2:54 am
Best Tutorials for Web Development » Blog Archive » What CSS3 Can Do For You: Typography and Special Effects
[...] To set up a certain font throughout the webpage, you can set up @font-face selector (not a new technique, but is honed with CSS3) to create the font you would like. An example of this is below, and provided by CARDEO. [...]
July 8, 2010 » 5:01 pm
designi1
You should had includ aller .otf as well for IE users. Or the font wont be rendered. Apart from that simple and well explain @font-face embembed
July 9, 2010 » 2:30 am
admin
Hey, check the browser support note at the top. As far as I know, IE doesn’t support any of this custom font css at this point. thanks
July 9, 2010 » 3:10 pm









Vinnie
Awesome job mate, really usefull thanks for share it.
Cheers.
March 21, 2010 » 6:26 am