@ font-face don't load font
I'm trying to use @ font-face and for some reason doesn't work (IE9, Chrome and Firefox). I made sure I was pointing to the correct directory when loading the font, but it still doesn't work.
Here is my code:
@font-face{
font-family: 'test';
src: url('../fonts/FontName.ttf'),
url('../fonts/FontName.eot');
font-weight: normal;
font-style: normal;
}
And calling it:
#header{
text-align:left;
padding: 10px;
font-family:test;
}
What am I doing wrong?
source to share
Internet Explorer uses the .woff version of the font you are not using in your code instead of using the .eot version. I used the @ font-face generato r tool from fontsquirrel to get all the font options
The result should look something like this:
@font-face{
font-family: 'test';
src: url('../fonts/FontName.eot'),
url('../fonts/FontName.eot?#iefix') format('embedded-opentype'),
url('../fonts/FontName.woff') format('woff'),
url('../fonts/FontName.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
source to share
in addition to what people have said about different types of fonts (and using an element format()
together with url()
) it would also be helpful to check your css property to make sure nothing is set #header
or elements inside it are on font-weight: bold
. Since you are only specifying a standard font with normal weight / normal style, if something makes it bold, the font will not display.
source to share