Any bug with hsla(0, 0%, 0%, 0), becoming hsla(0, 0, 0, 0)? (missing percent sign)

空扰寡人 提交于 2019-12-06 10:45:26

问题


I set up a text color as hsla(0, 0%, 0%, 0) to hide it. But sometimes it became hsla(0, 0, 0, 0), which can't be executed by browser.

I can fix this if I go the site with incognito mode. I have no idea if it's a bug in Chrome, from the server or just cache problem. If so, why it happens so often and how to fix it?


回答1:


Zero's should be unitless in css.

Lengths refer to distance measurements.The format of a length value (denoted by in this specification) is a (with or without a decimal point) immediately followed by a unit identifier (e.g., px, em, etc.). After a zero length, the unit identifier is optional.

See http://www.w3.org/TR/CSS2/syndata.html#length-units for more information.

Here is another Stackoverflow answer supporting this reason.



来源:https://stackoverflow.com/questions/31779146/any-bug-with-hsla0-0-0-0-becoming-hsla0-0-0-0-missing-percent-sig

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