/    Sign up×
Community /Pin to ProfileBookmark

Is correct in CSS code also 0 without px?

I have seen when I validate CSS that hey removed px when there is not positive value like 5px.

Is this also 100% correct?

Sample is margin-right : 0;

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@FangApr 14.2008 — A zero value does not require units
Copy linkTweet thisAlerts:
@aj_nscApr 14.2008 — Only when using 0 it is correct. Think about it, does it make a difference if it is 0em, 0%, or 0px?? of course not.
Copy linkTweet thisAlerts:
@felgallApr 14.2008 — 0in and 0cm also have the exact same size as well.

Of course 1px, 1pt, 1em, 1%, 1in and 1cm are all different sizes (unless you just happen to have your system configured so that two of them just happen to match) which is why you need to define the units since otherwise you have half the browsers assuming you meant attometres and the other half assuming you meant parsecs (except for IE which splits the difference and assumes pixels).
×

Success!

Help @toplisek spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.21,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...