basics of website design banner photo

HTML

HTML 5

CSS 2.1

CSS 3

Reference

Units of length in HTML and CSS.

There are two distinct types of length units used in Web design - relative and absolute. Relative lengths are calculated in relation to another length property whereas absolute lengths have a predetermined fixed size.

Relative

There are three relative length units:

Absolute

The absolute units:

Which to use - relative or absolute?

Using absolute lengths you are guaranteed a fixed size which means that layouts will never change whatever the screen resolution or window size. This is appealing to a designer but there are two good reasons why using relative units for on screen display is the best option:

Absolute units have a place in designs where the output size is known in advance such as layout for printing but when designing for the Web and the myriad of display devices and sizes employed to view sites it makes sense to use relative units.