Alex Rivera | Logout

The proper use of measurement units?

Asked 2012-03-24T16:47:59.953
13

I've been using px for almost all the measurement related styling, but I wanted to know the best places for the use of pixels (px), percentage (%), points (pt) and em.
I've seen the use of em and (I believe) points in typography, but I don't know the best way to use them.

Where should either be used, and why?

Edit
Report

1 Answer

1

Disclosure: I am a sysadmin, not a web designer.

I generally use em for padding around images, so as to keep the padding sized according to the text it keeps away from the image.

I use % to handle liquid/fluid layouts sometimes, though most often a fluid layout will just be 100% of the browser but with fixed width (px) columns.

I use px to handle column widths, headers, etc. The height and width attributes of an <img> tag are of course in pixels by default, and an image will render best if you don't ask the browser to resize it from its native/original resolution. In some cases, you need to use px on fonts, when the font has to work with an image (i.e. a spanner icon next to the word "Tools"). If possible, I always use UTF-8 fonts instead of images.

answered 2012-03-24T17:28:07.593

Your Answer