如何验证 CSS3 HSLA 颜色值?
我喜欢检查 CSS 有效性。它让事情变得更好。但是,我使用的样式表指定了一些颜色,如下所示......
border-right: 1px solid hsla( 0, 0%, 0%, 0.2 );
这会导致在使用 W3C 验证服务时出现错误(即使设置了 level=css3
),例如......
值错误:border-right 太多值或无法识别值:1px 实心 hsla(0,0%,0%,0.2 )
我也尝试过...
border-left: 1px solid ; border-left-color: hsla( 0, 0%, 100%, 0.3 );
但返回...
值错误:左边框颜色 hsla(0,0%,100%,0.3 ) 不是边框颜色值:hsla(0,0%,100%,0.3 )
我想这个符号只是一个“候选” ,根据此规范... 这是否意味着在这一点上验证它根本不是一个选项?是 alpha
绊倒了它。我可以以某种方式“打破这个值”吗?
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 );
which results in an error when using the W3C validation services (even with level=css3
set), such as...
Value Error : border-right Too many values or values are not recognized : 1px solid hsla(0,0%,0%,0.2 )
I also tried...
border-left: 1px solid ; border-left-color: hsla( 0, 0%, 100%, 0.3 );
but that returns...
Value Error : border-left-color hsla(0,0%,100%,0.3 ) is not a border-color value : hsla(0,0%,100%,0.3 )
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个已知的验证器错误,已报告。您的 CSS 声明都是有效的,对于验证器无法识别它们的情况,您可以或不需要采取任何措施。
顺便说一句,您引用的规范已过时; CSS3 颜色模块已经是W3C 建议。
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.
By the way, the spec you cite is out of date; the CSS3 Color Module is already a W3C Recommendation.