为什么我的< select> “字体家族”属性是< body>继承的? [英] Why isn't my <select> "font-family" property inheriting from <body>?
本文介绍了为什么我的< select> “字体家族”属性是< body>继承的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的代码:
body {
font-family:"Verdana",Arial,Helvetica,sans-serif;
}
.myfont {
font-family:"Verdana",Arial,Helvetica,sans-serif;
}
<body>
Hello
<select>
<option>
Hello
</option>
</select>
<select class="myfont">
<option>
Hello
</option>
</select>
</body>
为什么第一个< select>
元素没有继承<的规范中的
? font-family
属性; body>
Why is the first <select>
element not inheriting the font-family
property from the specification for <body>
?
如果我必须更改< select> $ c $的字体c>为什么我必须复制样式?
If I have to change the font for a <select>
why do I have to copy the style?
推荐答案
如果使用:
select {
font-family: inherit;
}
它将正常工作。在表单控件方面,CSS有点古怪。
It'll work fine. CSS is a little quirky when it comes to form controls.
这篇关于为什么我的< select> “字体家族”属性是< body>继承的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文