Tagged: units

Pixel-less layouts using em and %

In a time when the pixel density of mobile phones is no longer comparable to normal computer screens and laptops are going the same way, using pixels to set the dimensions of your website makes less sense than it used to. So let's build an alternative setup.

The other units

There are at least two other units that are useful for layout, em and %. 1em is equal to the current font-size and % means percentage of the surrounding element.

Percentage is a good second in popularity behind pixels, and em is not commonly used for other things than font sizes. But since em is not px, it has other advantages.

Continue reading