问题
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