Alternative CSS font settings for different browsers?

痴心易碎 提交于 2019-12-13 01:48:53

问题


Just curious if there was a way to change font size on a website depending on the browser. I have an @font-face that works in Chrome and Safari, and then my alternative font choice is being used in Internet Explorer and Firefox. My alternative font choice renders larger than my preferred choice. Is there a way to change the font size for only IE and Firefox? Thanks!


回答1:


You can detect the browser using JS and add a class to the HTML tag. You could use the following library for this: http://www.quirksmode.org/js/detect.html

If you add a Class for Firefox and IE, than in CSS you can use

.MSIE #mydiv
{
     // Something only for IE
}



回答2:


You can use CSS hacks or conditionals for load css files for a specific browser or css browser selectors...

for css hacks, check out this..https://github.com/ginader/CSS-Hacks for css browser selectors, http://rafael.adm.br/css_browser_selector/



来源:https://stackoverflow.com/questions/14633947/alternative-css-font-settings-for-different-browsers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!