The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Margins px vs %- which one?

As I am trying to learn CSS, I am looking at lots of peoples code, and see both px and % used for margins. When I experiment with CSS myself, I sometimes end up using both px and % for my margins as well....
Is this bad form to have them both mixed in your CSS?
Is there a general rule or preferance on using px or % when defining margins?

px are fixed width. Meaning if you give your body a margin left and rigth of 20 px, you get just that. % in margins give you screen proportion. Meaning if you give your body a margin left and right of 20% percent, the browser will compensate for whatever resolution you are on. From what I know, it doesn't matter if you intermix them. You could give your body left and right of % and a paragraph later down the road a margin left of a specified amount in pixels.

It doesn't matter if you mix and match, although you might get odd results at very large or very small resolutions. It's better to be consistent, though, so choose what works best for you and stick to it.