@font-face: bold in FF is bolder than in Chrome

后端 未结 9 1464
攒了一身酷
攒了一身酷 2021-01-31 05:03

I used this code:

@font-face {
    font-family: \'DroidSansRegular\';
    src: url(\'droidsans-webfont.eot\');
    src: url(\'droidsans-webfont.eot?#iefix\') for         


        
9条回答
  •  礼貌的吻别
    2021-01-31 05:39

    The Problem here is that FF takes the font and applies the bold font-weight to it (So basically it doubles the effect). Chrome doesn't seem to change the font-weight and just uses the right font. I think this happens because you declare two different font-families. The right CSS for this case would be:

    @font-face {
        font-family: 'DroidSans';
        src: url('droidsans-webfont.eot');
        src: url('droidsans-webfont.eot?#iefix') format('embedded-opentype'),
             url('droidsans-webfont.woff') format('woff'),
             url('droidsans-webfont.ttf') format('truetype'),
             url('droidsans-webfont.svg#DroidSansRegular') format('svg');
        font-weight: normal;
        font-style: normal;
    }
    @font-face {
        font-family: 'DroidSans';
        src: url('droidsans-bold-webfont.eot');
        src: url('droidsans-bold-webfont.eot?#iefix') format('embedded-opentype'),
             url('droidsans-bold-webfont.woff') format('woff'),
             url('droidsans-bold-webfont.ttf') format('truetype'),
             url('droidsans-bold-webfont.svg#DroidSansBold') format('svg');
        font-weight: bold;
        font-style: normal;
    }
    

    Notice that I changed the font-family to "DroidSans" not "DroidSansRegular" and "DroidSansBold".

提交回复
热议问题