不同浏览器的替代CSS字体设置? [英] Alternative CSS font settings for different browsers?

查看:427
本文介绍了不同浏览器的替代CSS字体设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是好奇,如果有一种方式来改变字体大小在网站上,取决于浏览器。我有一个@ font-face在Chrome和Safari中工作,然后我的替代字体选择正在Internet Explorer和Firefox中使用。我的替代字体选择呈现比我更喜欢的选择。有没有办法改变字体大小只有IE和Firefox?谢谢!

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!

推荐答案

您可以使用JS检测浏览器并向HTML标记添加类。您可以使用以下库: http://www.quirksmode.org/js/detect。 html

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

如果您为Firefox和IE添加一个Class,而不是在CSS中,则可以使用

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

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

这篇关于不同浏览器的替代CSS字体设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆