Every now and then you will find yourself having to repeat the same value for a particular property in several CSS rules. Sometimes doing so is necessary, but there are some situations when you can use the “inherit� value to avoid repeating yourself.
In my experience, the properties I use inherit
for most often are color
plus properties related to background
and font
(both shorthand and the individual properties like background-color
, font-size
and font-family
).
A few examples, then.
Posted in CSS.
Copyright © Roger Johansson