立诚勿怠,格物致知
It's all about connecting the dots

inheritance

Source: https://developer.mozilla.org/en-US/docs/Web/CSS/inheritance

Summary

The summary of every CSS property definition says whether that property is inherited by default (“Inherited: Yes”) or not inherited by default (“Inherited: no”). This controls what happens when no value is specified for a property on an element.

Inherited properties

When no value for an inherited property has been specified on an element, the element gets the computed value of that property on its parent element. Only the root element of the document gets the initial value given in the property’s summary.

A typical example of an inherited property is the color property. Given the style rules:


p { color: green }

and the markup:


This paragraph has emphasized text in it.

the words “emphasized text” will appear green, since the em element has inherited the value of the color property from the p element. It does not get the initial value of the property (which is the color that is used for the root element when the page specifies no color).

Non-inherited properties

When no value for an non-inherited property (sometimes called a reset property in Mozilla code) has been specified on an element, the element gets the initial value of that property (as specified in the property’s summary).

A typical example of a non-inherited property is the border property. Given the style rules:


p { border: medium solid }

and the markup


This paragraph has emphasized text in it.

the words “emphasized text” will not have a border (since the initial value of border-style is none).

Notes

The inherit keyword allows authors to explicitly specify inheritance. It works on both inherited and non-inherited properties.
赞(1) 打赏
文章名称:《inheritance》
文章链接:https://www.orzzone.com/inheritance.html
商业联系:yakima.public@gmail.com

本站大部分文章为原创或编译而来,对于本站版权文章,未经许可不得用于商业目的,非商业性转载请以链接形式标注原文出处。
本站内容仅供个人学习交流,不做为任何投资、建议的参考依据,因此产生的问题需自行承担。

评论 抢沙发

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力提供更多优质内容!

支付宝扫一扫打赏

微信扫一扫打赏

登录

找回密码

注册