我注意到在 <button>
的情况下标签,font-family 不会自动继承;要么我必须明确指定它:
<button style="font-family: some_style;">Button</button>
或者像这样使用inherit属性:
<button style="font-family: inherit;">Button</button>
但是,font-family 会在其他标签的情况下自动继承,<a>
例如标记。
为什么 <button>
会出现这个问题?标签?
这是一个 DEMO .
最佳答案
表单元素不继承字体设置,您必须手动设置这些属性。
如果您使用字体声明,例如。 body ,
body {font-family: arial, sans-serif}
只用
body, input, textarea, button {font-family: arial, sans-serif}
或
input, textarea, button {font-family: inherit}
关于html - 为什么 'font-family' 没有自动继承到 '<button>' 标签中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26140050/