There are very very few circumstances when I believe "pixels" are appropriate
I tend to only use pixels if I am assigning a background image to a tag. in other words, I have a list and I want to apply a small icon to one of the sides to "dress" it up. Some developers would just embed the image right into the HTML, however the image is not essential, its a cosmetic improvement, therefore it's correct declaration is through css as a background image. Since I know the dimensions of the image I will be using, and I know they wont change unless I physically go in and change the the image itself, this would be an instance where pixels are the correct tool. As I said before, they are not subject to font size changes, where em's are. I apply a left padding to the element I want the icon to appear left of (or right padding if i want the image on the right) and then I apply the background image. Depending on the size of the image, you may also need to apply a line-height property to account for the full height of the element.
Code:
selector {
padding: 20px;
background: url('/path/to/image.gif') no-repeat top left/right;
}
If I use em's in this instance, if the user increases or decreases their font-size beyond a certain point the text will not display properly in relation to the image.
Bookmarks