为什么“<button>"中没有继承“font-family"自动标记? [英] Why is 'font-family' not inherited in '<button>' tags automatically?
本文介绍了为什么“<button>"中没有继承“font-family"自动标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我注意到在 标签的情况下,font-family 不会自动继承;要么我必须明确指定它,如:
I have noticed that in case of <button>
tags, font-family is not inherited automatically; either I must specify it explicitly like:
<button style="font-family: some_style;">Button</button>
或者像这样使用继承属性:
<button style="font-family: inherit;">Button</button>
但是,font-family 会在其他标签的情况下自动继承,例如 标签.
However, the font-family is automatically inherited in case of other tags, the <a>
tag for example.
为什么我们的 标签会出现这个问题?
Why do we have this issue with the <button>
tags?
这是一个演示.
Here's a DEMO.
推荐答案
表单元素不继承字体设置,您必须手动设置这些属性.
Form elements don't inherit font settings, you have to set these properties manually.
如果您使用字体声明,例如.身体,
If you use font declaration for eg. body,
body {font-family: arial, sans-serif}
只用
body, input, textarea, button {font-family: arial, sans-serif}
或
input, textarea, button {font-family: inherit}
这篇关于为什么“<button>"中没有继承“font-family"自动标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文