I need to know the difference between these two. I'll show you the way that I do it, and the way someone else does it. Just need to know which way is correct and why. My way margin:0; They're way margin:0px; Also here is another example My way margin:0; display:block; background:transparent; They're way margin:0;display:block;background:transparent; They're way in another way margin: 0;display: block;background: transparent;
your way works but the reason they put px is that the margin can be site in different kinds of ways cm, piexls, or like how to do it blank just with the number. when the server reads the web site sometimes the spaces help read the css or html code thta you are using and after every ; must people do put a space there but ur website should still work they way that you are doing it but when you arer doing margins usually it is a good idea to but the tye of spacing you wan to use so the computer does not get the number mixed up
you put the px in there in case you have to come back and make it a positive #. if you're 100% sure you won't, just slap the 0 up there. spacing isn't really relevant except for readability. do what you are comfortable with or what the boss tells you. Some go to extremes with this, *shrug* I do it the way I like and skip the rest. I usually space it out like crazy something like margin: 0px ; background: transparent ; why? so its pretty obvious when I forget a ; or if I cut n paste over it. And I put 0px since it makes it easier if I need to quickly add space to an element to debug.
Shallowink is right. You should see some of the stuff my husband's boss puts out: #blah { position : relative; float : right; text-align: left; background: #f00 url(blah.gif) 0 0 no-repeat; } Code (markup): The extensive spacing should tip you off that it was written by a programmer and not a CSSer. The reason 0 = 0px/cm/pt/whatever is because zero is zero, regardless what it is you have zero of. 0apples is also still zero. I personally don't have units sitting on my zeros unless I removed a number and forget to take them out too.