* This is a core feature of CSS.
* The structure of an HTML document is similar to a family tree and each element can inherit properties from its parent.
* If we insert a style tag into the head tag and enter some rules, for example that all text in the body should be blue, then this value will be inherited by all the elements inside the body tag.
* NB: not every property in CSS is automatically inherited by its child (e.g. border) as it would not make sense. Only the ones that make sense are inherited.
* We can override the inheritance by specifying a new rule, e.g. that all text inside a 'p' tag should be orange.
* Inherited values will always lose out to explicitly specified values.
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment