Your .class h1
rule is applying a color directly to the h1
element itself, so it will never inherit the color from body
. The !important
only affects the body
element because it is the one with the ID. It does not force child elements to inherit that value. Specificity also becomes irrelevant since your selectors are targeting different elements.
In fact, the !important
doesn't play any role in your code and so it should be removed.