How can I use custom fonts on a website?

James Logan picture James Logan · Nov 27, 2012 · Viewed 144.9k times · Source

In order for my website to look good I need to use a custom font, specifically, Thonburi-Bold. The problem is - the font does not get displayed unless the user has installed it. It also isn't displayed in firefox.

Is there a workaround to this problem?

Answer

Zencode.dk picture Zencode.dk · Nov 27, 2012

You have to import the font in your stylesheet like this:

@font-face{
    font-family: "Thonburi-Bold";
    src: url('Thonburi-Bold.ttf'),
    url('Thonburi-Bold.eot'); /* IE */
}