You do not have a background color (or the background color is set to transparent), but you set the color

I get this warning (this is not an error, my CSS is valid).

I selected the full report to verify, to verify

You do not have a background color set (or background-color set to transparent), but you set the color. Make sure cascading colors keeps text intelligently legible.

What is it and how to solve it. I get this from a total of 57 selectors.

+4
source share
4 answers

Good @graphicdevine explanation on why warnings exist.

Instead of hard coding

background-color: #xxx; 

for each tag, I read the forum , which suggested putting this in:

 background-color: inherit; 

Also, at any place where you set the background color, but not the color of the text, enter:

 color: inherit; 

He resolved all these types of warnings for me.

+3
source

It covers a theoretical problem when the font color matches the phonogram, i.e.

 background-color: #fff; color: #fff; 

You don't need to worry about this, but if you want to get rid of warrning, I assume that just set the background color to match the message.

+1
source

Add background-color:#/*whatever you want*/; to all 57 selectors, and everything will be fine.

+1
source

You allow it:

Make [IN] certain that cascading colors keeps text intelligibly legible.

This is a warning that there may be something wrong, but that no tool can determine if something is really wrong.

(And, of course, reasonably readable is fairly open to interpretation. I use a color contrast analyzer , there are many other similar tools.)

+1
source

Source: https://habr.com/ru/post/1307772/


All Articles