CSS Measurements

They have: 1 posts

Joined: Apr 2007

Some CSS tutorials say the px is an absolute measurement while others say that it relative. So my question is which is it and why the confusion?

Also would it be better to use px or em when specifying font size? Many say that you should use em but to me it seems more complicated and easier to get stuff messed up on a page because its size is determined by the things around it. Thanks.

demonhale's picture

He has: 3,278 posts

Joined: May 2005

I use px to specify container widths, heights, paddings, margins... almost always ems for font sizes...

He has: 698 posts

Joined: Jul 2005

Well, if you use absolute measurements, which I believe px is, to determine the size of different containers and images, then using em for text sizes will allow the text to appear in the same ratio in all browsers to the things around it. If you use pixels, the text will appear smaller in larger resolution monitors and very large in the smaller-res monitors. Smiling

Kurtis

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.