CSS3 box-shadow property doesn't validate?

前端 未结 3 1042
梦谈多话
梦谈多话 2020-12-20 17:13

When I run my CSS through the W3C\'s validator, any time I use the box-shadow property, I get an error like this:

0 is not a box-shadow v

相关标签:
3条回答
  • 2020-12-20 17:51

    It's a known validator bug. Apparently they forgot that unitless values are permitted (especially unitless zero values). There's nothing wrong with your CSS; the values you're using are correct.

    If you're picky and you can't put up with the bug tarnishing your otherwise would-have-been successful validation, you can simply add units to your zero values:

    box-shadow: 0px 0px 10px #000;
    

    But whenever I run into situations like this, I normally don't bother, knowing that it's a harmless validator bug and not something wrong with my CSS.

    Note that as of this update the bug has been fixed since August 30, 2012.

    0 讨论(0)
  • 2020-12-20 18:01

    Change it to 0px 0px 10px #000 and it will validate. That's probably because of the beta version of the validator.

    0 讨论(0)
  • 2020-12-20 18:17

    The validator has a lot of bugs. Its new and its on beta stage.

    0 讨论(0)
提交回复
热议问题