When you validate your CSS file, do you get a load of warnings about background-color
not being accompanied by a color
and vice versa?
A lot of people see 'warning' and automatically think 'error' but they are just warnings and have to do with accessibility issues. For people who use their own stylesheets when browsing, if you have not set a background-color
and the color you've chosen for your text is the same as their custom background-color
, they won't be able to read the text.
What the Validator doesn't pick up on is if either the background-color
or color
have been inherited from a parent element. If you want to remove the warnings, the solution is to add color: inherit;
or background-color: inherit;
to every element that throws up a warning. This may not always be feasible in all situations.
It's up to you whether you think you need to go to that extra effort (and added file size of your CSS file) to appease the Validator.