I'm getting this Warning (it's not a error, my CSS is valid).
我得到这个警告(这不是错误,我的CSS是有效的)。
I choosed full report just to check to validate
我选择了完整的报告只是为了检查验证
You have no background-color set (or background-color is set to transparent) but you have set a color. Make sure that cascading of colors keeps the text reasonably legible.
您没有背景色设置(或者背景色设置为透明),但是您已经设置了一个颜色。确保颜色的层叠使文本保持合理的可读性。
What is this and how to solve. I'm getting this on total 57 selectors.
这是什么,怎么解。总共有57个选择器。
4 个解决方案
#1
3
Good explanation @graphicdevine on why the warnings are there.
很好的解释了为什么会有这些警告。
Instead of hard-coding
而不是硬编码
background-color: #xxx;
for each tag, I read on a forum that suggested putting this in:
对于每一个标签,我都在一个论坛上读到,建议把这个放进去:
background-color: inherit;
Also, anywhere you set a background color but not a text color, put in:
此外,无论你在什么地方设置背景色,而不是文本颜色,请输入:
color: inherit;
It resolved all of those type of warnings for me.
它为我解决了所有这些类型的警告。
#2
1
It covers theoretical problem when font colour is same as the backgound, i.e:
它涵盖了字体颜色与背景颜色相同时的理论问题,即:
background-color: #fff;
color: #fff;
You don't need to worry about it, but if you want to get rid of the warrning I'm guessing just set the background colour as per the message.
你不需要担心,但是如果你想要摆脱警告,我猜你应该根据信息设置背景颜色。
#3
1
Add background-color:#/*whatever you want*/;
to all 57 selectors and you should be fine.
添加背景颜色:# / *任何你想* /;对所有57个选择,你应该没事。
#4
1
You solve it by:
你解决了:
Make[ing] sure that cascading of colors keeps the text reasonably legible.
确保颜色的层叠能够使文本保持合理的易读性。
It's a warning that there might be something wrong, but that no tool is capable of discerning whether or not there actually is anything wrong.
这是一个警告,可能有什么问题,但没有任何工具能够识别出是否真的有什么问题。
(And of course, 'reasonably legible' is pretty open to interpretation. I use colour contrast analyser, many other, similar tools exist.)
(当然,“合理清晰”也很容易解释。我使用色彩对比分析仪,还有许多其他类似的工具。
#1
3
Good explanation @graphicdevine on why the warnings are there.
很好的解释了为什么会有这些警告。
Instead of hard-coding
而不是硬编码
background-color: #xxx;
for each tag, I read on a forum that suggested putting this in:
对于每一个标签,我都在一个论坛上读到,建议把这个放进去:
background-color: inherit;
Also, anywhere you set a background color but not a text color, put in:
此外,无论你在什么地方设置背景色,而不是文本颜色,请输入:
color: inherit;
It resolved all of those type of warnings for me.
它为我解决了所有这些类型的警告。
#2
1
It covers theoretical problem when font colour is same as the backgound, i.e:
它涵盖了字体颜色与背景颜色相同时的理论问题,即:
background-color: #fff;
color: #fff;
You don't need to worry about it, but if you want to get rid of the warrning I'm guessing just set the background colour as per the message.
你不需要担心,但是如果你想要摆脱警告,我猜你应该根据信息设置背景颜色。
#3
1
Add background-color:#/*whatever you want*/;
to all 57 selectors and you should be fine.
添加背景颜色:# / *任何你想* /;对所有57个选择,你应该没事。
#4
1
You solve it by:
你解决了:
Make[ing] sure that cascading of colors keeps the text reasonably legible.
确保颜色的层叠能够使文本保持合理的易读性。
It's a warning that there might be something wrong, but that no tool is capable of discerning whether or not there actually is anything wrong.
这是一个警告,可能有什么问题,但没有任何工具能够识别出是否真的有什么问题。
(And of course, 'reasonably legible' is pretty open to interpretation. I use colour contrast analyser, many other, similar tools exist.)
(当然,“合理清晰”也很容易解释。我使用色彩对比分析仪,还有许多其他类似的工具。