为什么'font-family'不能在'<按钮>'中继承标签自动? [英] Why is 'font-family' not inherited in '<button>' tags automatically?

查看:170
本文介绍了为什么'font-family'不能在'<按钮>'中继承标签自动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,在< button> 标签的情况下, font-family 不会自动继承;我必须明确地指定它:

 < button style =font-family:some_style;> Button<按钮> 

或使用继承属性:

 < button style =font-family:inherit;>按钮< /按钮> 

但是, font-family 会在其他标签自动继承,例如< a> 标记。为什么我们在< button> tags?



这是一个 ,您必须手动设置此属性。



如果您使用字体声明为例如。 body,

  body {font-family:arial,sans-serif} 

只需使用

  body,input,textarea {font -family:arial,sans-serif} 

 输入,textarea {font-family:inherit} 


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> 

or use inherit property like this:

<button style="font-family: inherit;">Button</button> 

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 element don´t inherit font settings, you have to set this properties manually.

If you use font declaration for eg. body,

body {font-family: arial, sans-serif}

use just

body, input, textarea {font-family: arial, sans-serif}

or

input, textarea {font-family: inherit}

这篇关于为什么'font-family'不能在'&lt;按钮&gt;'中继承标签自动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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