<输入>不从< body>继承字体 [英] <input> doesn't inherit the font from <body>

查看:105
本文介绍了<输入>不从< body>继承字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有输入和标签字段:

<label class="adm" for="UserName">User name</label>
<input class="adm" id="UserName" name="UserName" size="30" type="text" value="" />

和CSS:

body,html { font-family: Verdana,Arial,Helvetica,sans-serif; margin:0; padding:0; color: #111;}
label.adm  { font-size:0.9em; margin:0 0 3px 3px; display: block;}
input.adm  { font-size:0.9em; margin:0 0 3px 3px; }

在Firefox中打开代码时,字体不同. Firebug显示应该"继承,并且当我查看计算结果时,它显示标签使用Verdana.但是输入显示它使用"MS Shell Dlg".

When the code opens up in Firefox the fonts are not the same. Firebug shows that both "should" inherit and when I look at computed it shows the label uses Verdana. However the input shows it uses "MS Shell Dlg".

任何人都可以解释正在发生的事情以及为什么它似乎不遵循正常的CSS规则吗?

Can anyone explain what's happening and why it doesn't seem to obey the normal CSS rules?

推荐答案

默认情况下它不会继承,但您可以将其设置为使用CSS继承

It does not inherit by default but you can set it to inherit with css

input, select, textarea, button{font-family:inherit;}

演示: http://jsfiddle.net/gaby/pEedc/1/

这篇关于&lt;输入&gt;不从&lt; body&gt;继承字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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