首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Firefox和Chrome中的字体外观不同

Firefox和Chrome中的字体外观不同
EN

Stack Overflow用户
提问于 2011-01-15 15:52:24
回答 11查看 93.8K关注 0票数 40

我正在使用Google Web Font的PT-sans

font-family: 'PT Sans',Arial,serif;

但它在Chrome和Firefox中看起来不同

有没有什么需要我添加的,以便它在所有浏览器中看起来都一样?

EN

回答 11

Stack Overflow用户

回答已采纳

发布于 2011-01-15 15:55:42

css重置可能会解决这个问题,我不确定。

http://yuilibrary.com/yui/docs/cssreset/

票数 5
EN

Stack Overflow用户

发布于 2011-12-11 20:21:43

对于来自FontSquirrel的ChunkFive字体,指定" font -weight: normal;“阻止了火狐在标题中使用时的渲染效果看起来很糟糕。看起来Firefox试图对只有一个粗体的字体应用一个假粗体,而Chrome则不是。

票数 25
EN

Stack Overflow用户

发布于 2012-09-06 23:06:25

对我来说,Chrome网页字体看起来很糟糕,直到我把SVG字体放在WOFF和TrueType之前。例如:

@font-face {
    font-family: 'source_sans_proregular';
    src: url('sourcesanspro-regular-webfont.eot');
    src: url('sourcesanspro-regular-webfont.eot?#iefix') format('embedded-opentype'),
         url('sourcesanspro-regular-webfont.svg#source_sans_proregular') format('svg'),
         url('sourcesanspro-regular-webfont.woff') format('woff'),
         url('sourcesanspro-regular-webfont.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

即便如此,Chrome的字体看起来还是比Firefox或IE要薄。Chrome在这一点上看起来不错,但我通常想在IE和Firefox中设置不同的字体。我混合使用IE条件注释和jQuery来根据浏览器设置不同的字体。对于Firefox,我让以下函数在页面加载时运行:

function setBrowserClasses() {
    if (true == $.browser.mozilla) {
        $('body').addClass('firefox');
    }
}

然后在我的CSS中,我可以说

body { font-family: "source_sans_proregular", Helvetica, sans-serif; }
body.firefox { font-family: "source_sans_pro_lightregular", Helvetica, sans-serif; }

同样,在IE条件注释中包含的仅限IE的样式表中,我可以这样说:

body { font-family: "source_sans_pro_lightregular", Helvetica, sans-serif; }
票数 12
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4698564

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档