Why is 'font-family' not inherited in '<button>' tags automatically?

后端 未结 3 1711
别跟我提以往
别跟我提以往 2020-12-16 11:13

I have noticed that in case of

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-16 11:53

    If you inspect your demo in a browser using its Developer Tools, you can see that the font family of the button element comes from the browser style sheet. They show this in different ways, and they may use different fonts there, but the principle is the same: there is a declaration for the font-family property of the element in some style sheet, hence that property cannot be inherited (unless you explicitly set the value inherit on it, of course).

    This is not defined in specifications, but neither are such browser style sheet settings prohibited by them, and they are common practice.

提交回复
热议问题