HTML and CSS Reference
In-Depth Information
Chapter 13
The font properties can be used to change aspects of the font and to load custom fonts.
They can be applied to any element and they all inherit.
font-family sets the face of the font. Its value can be a specific font name such as times
or verdana ; or a generic family name such as sans-serif , serif , or monospace .
font-family : inherit | <family-names> | <generic-families>
The value for this property is a prioritized list of one or more font names. If a browser
does not have access to the first font, it uses the next font and so on.
font-family: "Times New Roman", times, serif;
It is recommended to end the list with a family name to make sure that at least the
font family is consistent across browsers. Note that if a font name includes spaces, it must
be surrounded by double quotes, as in the previous example.
font-size sets the size of the font. The value can be any unit of measure or a percentage
of the parent's font size. There are also a couple of predefined values, as listed here:
font-size : inherit | <length> | <percentage> |
smaller | larger | xx-small | x-small |
small | medium | large | x-large | xx-large
The larger and smaller values are relative to the parent's font size; the other
predefined values refer to absolute sizes. The initial size is medium , which is 1 em
(16 pixels) for normal text.
Search WWH ::

Custom Search