In this example directory-result ul
represents a block - some sort of list/menu where pixel dimensions are quite important. We can’t always rely on em
which defines the text size, because if we need 20px space due to some background image – well, we need 20px, no compromises.
Note that you can't create and save the image i.e. 10em wide, therefore I see no reason why should I use different units on a web page. It just creates confusion and later on it is very difficult to maintain the layout.
There is a one place though, where using em
is advisable – I’m talking about text blocks. I’m guessing in your code about-text
is placed within other text where adding top/bottom margin of 1em (height of text) makes sense. It’s like in any text editor (i.e. line spacing in MS Word) – text looks best when spacing between lines is defined by multiplying the height of text
So in my opinion – everywhere where you deal with design and you use images by default measured in pixels – usepixels
for all padding/margin.
Everywhere where you deal with text inside a text block, and you want to add even spacing between the text nodes – useem
.