为什么< input>继承自body的字体? [英] Why doesn't <input> inherit the font from body?

查看:88
本文介绍了为什么< input>继承自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". Can anyone explain what's happening and why it doesn't seem to obey the normal CSS rules?

Judy

推荐答案

它不会默认继承,但可以设置为继承css

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

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

demo:http://jsfiddle.net/gaby/pEedc/1/

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

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