Fonts looks different in Firefox and Chrome

前端 未结 10 1059
时光取名叫无心
时光取名叫无心 2020-11-29 04:03

I am using Google Web Font\'s PT-sans

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

but it looks different in Chrome and Firefox

Is there

10条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-29 04:31

    For me, Chrome web fonts look crappy until I put the SVG font ahead of WOFF and TrueType. For example:

    @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;
    }
    

    Even then, Chrome's fonts look thinner than in Firefox or IE. Chrome looks good at this point, but I usually want to set different fonts in IE and Firefox. I use a mixture of IE conditional comments and jQuery to set different fonts depending on the browser. For Firefox, I have the following function run when the page loads:

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

    Then in my CSS, I can say

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

    Likewise, in an IE-only stylesheet included within IE conditional comments, I can say:

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

提交回复
热议问题