'property:0'或'property:0px'in CSS? [英] 'property: 0' or 'property: 0px' in CSS?

查看:155
本文介绍了'property:0'或'property:0px'in CSS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到这个符号使用了很多,我想知道,这两个符号之间有什么显着的区别吗?

I've seen this notation used a lot, and I was wondering, is there is any notable difference between these two notations?

element#id
{
  property: 0;
}

element#id
{
  property: 0px;
}

我使用属性:0px; 所有的时间,因为我发现它更干净的看,但我不是真的确定浏览器解释 0px 不同于 0

I use property: 0px; all the time, as I find it cleaner looking, but I'm not really sure if the browser interprets 0px differently than 0.

有谁知道哪一个更好或更正?谢谢!

Does anyone know which one is better or correct? Thanks!

推荐答案

当值为 0 ,我倾向于保留它,因为我可以通过点击该值并按向上/向下箭头键,使用Chrome的开发人员工具调整值。没有单元,这是不可能的。

While the unit is optional when the value is 0, I tend to leave it in, as I can then tweak the values with Chrome's Developer Tools by clicking on the value and pressing the up/down arrow keys. Without a unit, that isn't really possible.

此外,CSS minifiers剥离 0 值反正,所以到底是什么真的不重要。

Also, CSS minifiers strip the units off of 0 values anyways, so it won't really matter in the end.

这篇关于'property:0'或'property:0px'in CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆