Inheritance
- Some CSS properties, by default, inherit values from the parent and some don't.
- Inheritance help us write less code.
div {
color: red;
}
<div><p>this is a para</p></div>
Possible Values
initial
- Stop inheritance
inherit
- Sets the property value to be the same as that of its parent element. Effectively, this "turns on inheritance".
p {
border: inherit;
}
unset
Resets the property to its natural value, which means that if the property is naturally inherited it acts like inherit
, otherwise it acts like initial
.