如何验证 CSS3 HSLA 颜色值? [英] How to validate CSS3 HSLA color values?

查看:31
本文介绍了如何验证 CSS3 HSLA 颜色值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

喜欢检查 CSS 有效性.它使事情变得更好.但是,我使用的样式表指定了一些颜色,就像这样..

I like checking CSS validity. It makes things work better. However, a stylesheet I'm using specifies some colors, like so..

border-right: 1px solid hsla( 0, 0%,   0%, 0.2 );

在使用 W3C 验证服务时会导致错误(即使设置了 level=css3),例如...

which results in an error when using the W3C validation services (even with level=css3 set), such as...

值错误:border-right 太多的值或无法识别的值:1px solid hsla(0,0%,0%,0.2)

Value Error : border-right Too many values or values are not recognized : 1px solid hsla(0,0%,0%,0.2 )

我也试过...

border-left:  1px solid ; border-left-color: hsla( 0, 0%, 100%, 0.3 );

但这会返回...

值错误:border-left-color hsla(0,0%,100%,0.3) 不是边框颜色值:hsla(0,0%,100%,0.3)

Value Error : border-left-color hsla(0,0%,100%,0.3 ) is not a border-color value : hsla(0,0%,100%,0.3 )

我猜这个符号只是一个候选",根据本规范... 这是否意味着在这一点上验证它根本不是一种选择?是 alpha 绊倒了它.. 我能以某种方式打破那个值"吗?

I guess this notation is simply a "candidate", according to this spec... Does that mean validating it, at this point, is simply not an option? It's the alpha that's tripping it up.. Can I "break that value out", somehow?

推荐答案

这是一个已知的验证器错误,已报告.您的 CSS 声明都是有效的,对于验证器无法识别它们,您无能为力或无需采取任何措施.

This is a known validator bug which has been reported. Your CSS declarations are all valid, and there's nothing you can or need to do about the validator failing to recognize them.

顺便说一下,你引用的规范已经过时了;CSS3 颜色模块已经W3C 推荐.

By the way, the spec you cite is out of date; the CSS3 Color Module is already a W3C Recommendation.

这篇关于如何验证 CSS3 HSLA 颜色值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆