简体   繁体   English

W3C CSS 验证器在 svg 规则上显示错误:“只有 0 可以是一个单位”

[英]W3C CSS Validator shows error on svg rule: “only 0 can be a unit”

I have an svg that changes its fill and stroke on hover with some transition.我有一个 svg,它在悬停时通过一些过渡来改变它的填充和描边。 I tried using W3C CSS Validator on my css and one of the errors that showed up was this:我尝试在我的 css 上使用 W3C CSS Validator,出现的错误之一是:

only 0 can be a unit. You must put a unit after your number : 2

But I cannot identify nor understand what the error is.但我无法识别或理解错误是什么。 What is wrong in here:这里有什么问题:

svg a:hover circle {
  fill: #ffff00;
  fill-opacity: .5;
  stroke: black;
  stroke-width: 2;
  transition: 200ms;
  transition-timing-function: ease-in-out;
  -webkit-transition: 200ms;
  -webkit-transition-timing-function: ease-in-out
}

You need a unit (eg px) after the 2 in stroke-width: 2;stroke-width: 2;2之后需要一个单位(例如px) stroke-width: 2; . . So like stroke-width: 2px;所以像stroke-width: 2px; . . Zero ( 0 ) is allowed because it has no value and a unit is irrelevant on it.零 ( 0 ) 是允许的,因为它没有价值,并且与它无关。

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

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