What is a pixel and is this the only measure of font size?


#1

Question

What is a pixel and is this the only measure of font size?

Answer

A pixel is one of several units of measure in web development. It is an absolute unit equal to 1/96 of an inch.

Rems and ems are scalable typographic units which are commonly used with the font-size property. As opposed to pixels, both of these units are relative. For example, an em is measured relative to the font-size of an element. When dealing with ems it is important to realize that the font-size of an element is often inherited from an ancestor element. On the other hand, rems are determined based on the font-size of the html element. If font-size is not defined on the html element, the browser’s default font-size is used instead (usually 16px).

There are pros and cons of each unit but one major advantage of using relative units is that they lend themselves more naturally to responsive design. Relative units like ems and rems are flexible and scalable whereas pixels are not.


FAQ: Learn CSS Selectors Visual Rules - CSS Visual Rules - Font Size
#2

We can (and probably should) make an explicit declaration to adopt the browser’s default size at load time.

body {
    font-size: 100%;
}

Users with visual impairment often need larger fonts on everything and may set their browser to a size that suits them. The user is the most important person and by adopting the browser’s default and then making all our fonts relative to that we make the experience for those users appropriate to their needs.