How to validate CSS3 HSLA color values?

丶灬走出姿态 提交于 2019-12-12 17:20:44

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/9317057/how-to-validate-css3-hsla-color-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!