1

I have a code in html and css. I want to use a special font I've downloaded and after searching some, I wrote the code below:

    <head>
        <style>
        @font-face
        {
            font-family: paraaminobenzoic;
            src: url('paraaminobenzoic.otf');
        }
        p.custom_font {font-family: paraaminobenzoic;}
        </style>
    </head>

and it doesn't work and I don't know why. especially I don't know whether I added the code below in the right position or not.

p.custom_font {font-family: paraaminobenzoic;}

can anyone help noticing the problem?

Melika Barzegaran
  • 429
  • 2
  • 9
  • 25

2 Answers2

3

the correct format for font face should be:

@font-face{ 
font-family: 'MyWebFont';
src: url('WebFont.eot');
src: url('WebFont.eot?iefix') format('eot'),
     url('WebFont.woff') format('woff'),
     url('WebFont.ttf') format('truetype'),
     url('WebFont.svg#webfont') format('svg');
}

TTF - Works in most browsers except IE and iPhone.

EOT - IE only.

WOFF - Compressed, emerging standard.

SVG - iPhone/iPad.

Take a look here: http://www.fontspring.com/support/installing_webfonts/how-do-i-use-the-webfonts

wf4
  • 3,727
  • 2
  • 34
  • 45
2

Try adding quotes in the following manner -

<head>
    <style>
    @font-face {
        font-family: "paraaminobenzoic";
        src: url("paraaminobenzoic.otf");
    }
    p.custom_font {
        font-family: "paraaminobenzoic";
    }
    </style>
</head>
divyaSharma
  • 133
  • 2
  • 11