2016-12-06 53 views
0

我有一个在Firefox上错误地呈现某些字符的字体。如果检测到Firefox,我想将字体更改为其他字体。我试过这种技术:如何专门针对Firefox浏览器?

body:not(:-moz-handler-blocked) .altFont { 
    font-family: helvetica, arial, sans-serifs !important; 
} 

它没有工作,也在Firefox网站上它说它不被推荐。我想知道是否有其他方法可以检查?

回答

2

使用以下语法目标器火狐浏览器的任何版本:

@-moz-document url-prefix() { 
    /* Styles to be executed on firefox */ 
    body .altFont { 
    font-family: helvetica, arial, sans-serifs !important; 
    } 
} 

参考:CSS hacks targeting firefox