Back to the index.
The inherit, initial, and unset keywords are special values you can give to any CSS property.
color or font-family, are automatically inherited, but others, such as display or margin, aren’t. The inherit keyword should work on all CSS properties, though.float: none), sometimes it’s there for historical reasons (background-repeat: repeat), and sometimes the spec writers made an essentially random-though-somewhat-defensible choice (color: black).color), or the initial value if the property is normally not inherited (such as display).color), or the value defined in the browser style sheet if the property is normally not inherited (such as display).This page has a few extra styles for testing purposes:
color: inherit forces these elements to blue as well.color is black. Thus, setting code: initial should force all elements to a black color.color: unset should force them all to inherit, and thus blue.color: revert should force them all to inherit, and thus blue. The buttons (and the select boxes below) remain stubbornly black, though, apparently honouring the browser style sheet, which contains
button {color: black}. I do not understand this behaviour, so I’m going to say form elements are weird.display: inherit makes all children of the body block-level elements, since the body has display: block.display is inline. Thus, setting display: initial should make all children of the body inline elements.display: unset should force all elements to initial, and thus inline.display: revert should force all elements to the values defined in the browser style sheet. Thus, the page will look normal, except that we lose the display: grid on this list, since a dl’s
browser style is display: block.Anyway, play with these values. Select a property and a value and see what happens. Try to make a prediction of what should happen — and remember some browsers don’t support unset or initial.
body * {
: !important;
}