What is the purpose of using font: inherit?

前端 未结 7 917
醉酒成梦
醉酒成梦 2020-12-25 10:16

I just wanted to know why font: inherit; is used in Cascading Style Sheets.

7条回答
  •  隐瞒了意图╮
    2020-12-25 10:42

    The inherit is used to get the properties from the parent element. In other words, inherit the properties of parent element.

    The default property is inherit, it means, say you have div and a p.

    Hello World!

    Now you give a style:

    div {font-famlily: Tahoma;}
    p {font-family: inherit;}
    

    That font-family is inherited to the p from its parent element div.

提交回复
热议问题