您没有设置背景颜色(或背景颜色设置为透明),但您设置了颜色
我收到此警告(这不是错误,我的 CSS 有效)。
我选择完整报告只是为了检查以验证
您没有设置背景颜色(或者 背景颜色设置为 透明)但您已经设置了颜色。 确保颜色层叠 保持文本合理易读。
这是什么情况以及如何解决。我在总共 57 个选择器上得到了这个。
I'm getting this Warning (it's not a error, my CSS is valid).
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
@graphicdevine 很好地解释了为什么会出现警告。
我没有对每个标签进行硬编码
,而是阅读 论坛建议将其放入:
此外,在您设置背景颜色而不是文本颜色的任何地方,放入:
它解决了所有这些类型对我的警告。
Good explanation @graphicdevine on why the warnings are there.
Instead of hard-coding
for each tag, I read on a forum that suggested putting this in:
Also, anywhere you set a background color but not a text color, put in:
It resolved all of those type of warnings for me.
它涵盖了当字体颜色与背景相同时的理论问题,即:
您不需要担心它,但如果您想摆脱警告,我猜只需根据消息设置背景颜色即可。
It covers theoretical problem when font colour is same as the backgound, i.e:
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.
将
background-color:#/*whatever youwant*/;
添加到所有 57 个选择器中,应该没问题。Add
background-color:#/*whatever you want*/;
to all 57 selectors and you should be fine.您可以通过以下方式解决:
这是一个警告,表明可能出现问题,但没有任何工具能够辨别是否确实存在任何问题。
(当然,“相当清晰”是很容易解释的。我使用 颜色对比分析器,还有许多其他类似的工具。)
You solve it by:
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.)