JavaScript and client side scripting.
Moderator: General Moderators
nigma
DevNet Resident
Posts: 1094 Joined: Sat Jan 25, 2003 1:49 am
Post
by nigma » Sun Sep 28, 2003 1:32 am
Hey, anyone know the diff between:
And:
jollyjumper
Forum Contributor
Posts: 107 Joined: Sat Jan 25, 2003 11:03 am
Post
by jollyjumper » Sun Sep 28, 2003 6:01 am
Hi Nigma,
There is no difference. There are a few different measurements in css, like px(pixels), pt(points), like there are in the real world(centimeter and inch for example), but 0 cm or 0 inch is still nothing.
So with 0 it isn't necesary to give a measurement.
Greetz Jolly.
nigma
DevNet Resident
Posts: 1094 Joined: Sat Jan 25, 2003 1:49 am
Post
by nigma » Sun Sep 28, 2003 11:20 am
Doesn't margin default to 0? Why would someone put margin: 0 when it is by default set to that?
Cruzado_Mainfrm
Forum Contributor
Posts: 346 Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL
Post
by Cruzado_Mainfrm » Sun Sep 28, 2003 1:50 pm
i don't thing the margins are default set to 0px, for example in frames they are like 5px or something like that...
evilMind
Forum Contributor
Posts: 145 Joined: Fri Sep 19, 2003 10:09 am
Location: Earth
Post
by evilMind » Sun Sep 28, 2003 3:14 pm
Cruzado_Mainfrm is correct. All browsers have different margins that they set by default for the html < body > < / body > tag.
McGruff
DevNet Master
Posts: 2893 Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland
Post
by McGruff » Sun Sep 28, 2003 3:17 pm
Also they might be overiding something - for example by defining an inline style to overide a custom tag.
nigma
DevNet Resident
Posts: 1094 Joined: Sat Jan 25, 2003 1:49 am
Post
by nigma » Sun Sep 28, 2003 3:57 pm
Excellent guys, thanks a bunch!
Unipus
Forum Contributor
Posts: 409 Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA
Post
by Unipus » Mon Sep 29, 2003 2:52 pm
Use 0px. If you try to validate your pages, they may not validate without a unit accompanying each measurement. It's just good practice to get into.
microthick
Forum Regular
Posts: 543 Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC
Post
by microthick » Mon Sep 29, 2003 2:57 pm
I tend to base a lot of my CSS style off of examples from Jeffrey Zeldman's site. He uses 0 rather than 0px, so I use 0.
Unipus
Forum Contributor
Posts: 409 Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA
Post
by Unipus » Mon Sep 29, 2003 3:07 pm
I'm surprised to hear that. Zeldman's usually got it all figured out. Maybe 0 is an exception to the rule, but if you try to validate any other measurement without a unit, it won't work.
microthick
Forum Regular
Posts: 543 Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC
Post
by microthick » Mon Sep 29, 2003 3:22 pm
Yes, it seems to be the only case where he does it. But as jollyjumper said above, 0 cm is the same as 0 px, etc, so no unit is necessary I suppose.
Unipus
Forum Contributor
Posts: 409 Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA
Post
by Unipus » Mon Sep 29, 2003 3:48 pm
Oh well. My point still stands: it's good practice to ALWAYS put a unit after your declarations.
nigma
DevNet Resident
Posts: 1094 Joined: Sat Jan 25, 2003 1:49 am
Post
by nigma » Mon Sep 29, 2003 10:59 pm
I actually just bought his book a few days ago.