简体   繁体   English

如何验证CSS3 HSLA颜色值?

[英]How to validate CSS3 HSLA color values?

I like checking CSS validity. 喜欢检查CSS有效性。 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... 使用W3C验证服务(即使设置了level=css3 )时,这会导致错误,例如...

Value Error : border-right Too many values or values are not recognized : 1px solid hsla(0,0%,0%,0.2 ) 值错误:右边界过多的值或无法识别的值:1px固体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 ) 值错误:border-left-color hsla(0,0%,100%,0.3)不是border-color值: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? alpha将其绊倒。我能以某种方式“突破这一价值”吗?

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. 您的CSS声明都是有效的,对于验证器无法识别它们,您无能为力。

By the way, the spec you cite is out of date; 顺便说一句,您引用的规范已经过时了。 the CSS3 Color Module is already a W3C Recommendation . CSS3颜色模块已经是W3C推荐标准

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM