@font-face issues in IE

2019-08-24 05:08发布

问题:

So I'm using @font-face for my portfolio website, and all is OK in Chrome, Firefox and Safari - but IE is proving a problem.

The following is in my CSS file;

@font-face {
font-family:"League"
src: url('sources/League_Gothic.otf')format('opentype');
}

And then for IE, I have the following on the main HTML page.

<!--[if IE]>

<style type="text/css" media="screen">

@font-face{
    font-family:'League';
    src: url('sources/league_gothic-webfont.eot');
}

</style>

<![endif]-->  

I created the .eot file from the .oft file on Font Squirrel, but IE continues to just use the default Times New Roman.

Any suggestions?

PS. My site is at iamturner.co.uk

回答1:

Fontsquirrel offers a "font-face package" download, which contains not only the various fonts themselves, but also a CSS stylesheet to put them on your page. Look at the generated stylesheet; it's not perfect for production use, but it does work in all the browsers you mention, and you can use it as a basis for your own stylesheets. (This once, conditional comments aren't needed BTW).