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

后端 未结 9 1564
攒了一身酷
攒了一身酷 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:28

    The issue is that Firefox tries to add the bold affect to text even for custom fonts that are already bold. I've just had the exact same situation, and resolved it by setting font-weight: normal; on the @font-face declaration.

    Example:

    @font-face {
        font-family: 'DroidSansBold';
        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: normal;
        font-style: normal;
    }
    

    You'll also need to use font-weight:normal; on any element (e.g. h1, h2, etc) that would otherwise have font-weight:bold; set otherwise Firefox will still add bold to the custom font.

提交回复
热议问题