The font-size
property can accept values of type length
. As of the time of writing, the exhaustive list of these types (excluding experimental units) is:
em, ex, ch, rem, vh, vw, vmin, vmax, px, mm, cm, in, pt, pc
So, yes. You can use cm
(centimeters) as a unit for that property. You should be aware, though, that 1cm
rarely equals one true centimeter on screen, due to differing pixel densities on various displays. If that's really what you want, you could use the mozmm
unit of measurement, although it is an experimental unit that is only supported by Firefox browsers. The cm
unit is used more often in stylesheets targeted at physical printed media.
The font-family
property accepts a stack (comma-separated list) of font family names. The browser will use the first one in the stack that it happens to recognize (installed on the computer).
Using font-family: Arial
is a pretty safe bet, since almost all computers have the Arial font, but to be safe it is best to include a couple of fall-back fonts. Quotation marks (or single-quotes) are traditionally used around multi-word font names or font names with numbers or symbols in them. It is also considered best-practice to include a <generic-name>
at the end of the list. The exhaustive list of generic fonts is:
serif, sans-serif, monospace, cursive, fantasy
So, the second option you listed for font-family
is a little bit more "bulletproof". It lists some fall-back options and ends with a generic font in case the client has none of the hand-picked fonts installed.