css @font-face not working with firefox

家住魔仙堡 提交于 2019-12-20 06:41:33

问题


The following code works in Google Chrome beta as well as IE 7 but not in firefox.

@font-face {
font-family: 'open_sans_semiboldregular';
src: url('../fonts/opensans-semibold-webfont.eot');
src: url('../fonts/opensans-semibold-webfont.eot?#iefix') format('embedded-opentype'),
     url('../fonts/opensans-semibold-webfont.woff') format('woff'),
     url('../fonts/opensans-semibold-webfont.ttf') format('truetype'),
     url('../fonts/opensans-semibold-webfont.svg#open_sans_semiboldregular') format('svg');

}


回答1:


try this

@font-face
{
    font-family: 'SegoeUI';
    src: url('Fonts/segoeui.eot');
    src: url('Fonts/segoeui.eot?#iefix') format('embedded-opentype'), url('fonts/segoeui.ttf') format('truetype');
}

@font-face
{
    font-family: 'SegoeLight';
    src: url('Fonts/segoeuil.eot');
    src: url('Fonts/segoeuil.eot?#iefix') format('embedded-opentype'), url('fonts/segoeuil.ttf') format('truetype');
}



回答2:


For an easier solution, try using Google Web Fonts: http://www.google.com/webfonts

The specific header code to include Open Sans semi-bold is:

<link href='http://fonts.googleapis.com/css?family=Open+Sans:600' rel='stylesheet' type='text/css'>

And then in the CSS it would be:

body {font-family: 'Open Sans', sans-serif;}

This will not only address cross-browser compatibility, but speed up your page load due to being hosted on Google's servers.



来源:https://stackoverflow.com/questions/14785088/css-font-face-not-working-with-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!