简体   繁体   中英

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. I tried using W3C CSS Validator on my css and one of the errors that showed up was this:

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; . So like stroke-width: 2px; . Zero ( 0 ) is allowed because it has no value and a unit is irrelevant on it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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