css - 可以将维度设置为 "0"而不带单位吗?

标签 css dimensions units-of-measurement

css 中的尺寸可以设置为“0”,没有任何单位吗?因为在我的世界里,“0 px”和“0 cm”、“0 em”甚至“0%”一样长。

例子:

width:0;

谢谢!

最佳答案

是的,它可以:非单位0测量绝对没问题:

Lengths refer to distance measurements and are denoted by <length> in the property definitions. A length is a dimension. A zero length may be represented instead as the <number> ‘0’. (In other words, for zero lengths the unit identifier is optional.)

(强调我的)。

引用:

关于css - 可以将维度设置为 "0"而不带单位吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10984925/

相关文章:

html - 如何将我的 css 连接到存储在 WEB-INF 文件夹中的 JSP 文件?网页/JSP

python - LSTM keras - 值错误如何解析输入维度

matlab - Matlab错误使用错误-矩阵尺寸必须一致

Java UOM java.lang.NoSuchFieldError : ONE

javascript - Bootstrap 示例 Carousel 代码不切换幻灯片

html - 为什么我的搜索按钮在搜索栏下方

r - 是否可以将 ggplot 与 R 中的单位包一起使用?

python - 通过自动缩放 SI 前缀来漂亮地打印物理量

css - 如何摆脱 Google 自定义搜索代码段悬停边框?

javascript - 为什么在 IE8 上的 JavaScript 中访问图像的尺寸如此昂贵?