Font Properties







PropertyDescriptionPossible ValuesExamples
font-familyDeclares the name of the font to be used. Previously set in HTML via the face attribute in a tag.Valid font family names or generic family names, i.e. Arial, Verdana, sans-serif, "Times New Roman", Times, serif, etc.

Font family names can be separated by a comma in the same declaration to allow additional and/or generic family names to be used if the prefereed font is unable to be displayed.

div { font-family:Arial; }

div { font-family:Arial, Helvetica, sans-serif; }

font-sizeDeclares the size of the font. Previously set in HTML via thesize attribute in a tag.Lengths (number and unit type— i.e. 1em,12pt, 10px, 80%) or one of the following predefined values:

xx-small
x-small
small
medium
large
x-large
xx-large
smaller
larger

div { font-size:70%; }

div { font-size:0.85em; }

div { font-size:medium; }

font-size-adjustLimited browser support: Was part of CSS 2, but not in CSS 2.1. This property may return in CSS 3.

Declares the aspect value(font size divided by x-height).

Numeric value
div { font-size-adjust:0.54; }

div { font-size-adjust:0.46; }

font-stretchLimited browser support: Was part of CSS 2, but not in CSS 2.1. This property may return in CSS 3.

Declares the stretch of the font face.

normal
wider
narrower
ultra-condensed
extra-condensed
condensed
semi-condensed
semi-expanded
expanded
extra-expanded
ultra-expanded
div { font-stretch:narrower; }

div { font-stretch:ultra-expanded; }

font-styleDeclares the font style.
normal
italic
oblique
div { font-style:italic; }

div { font-style:oblique; }

font-variantDeclares the font variant.
normal
small-caps
div { font-variant:normal; }

div { font-variant:small-caps; }

font-weightDeclares the font weight (lightness or boldness)
normal
bold
bolder
lighter
100
200
300
400
500
600
700
800
900
div { font-weight:bolder; }

div { font-weight:200; }

fontUsed as a shorthand property to declare all of the font properties at once (except font-size-adjust and font-stretch).Separate values by a space in the following order (those that are not defined will use inherited or default initial values):

font-style
font-variant
font-weight
font-size
line-height
font-family

div { font:italic small-caps bold 1em 1.2em Arial }

div { font:bold 0.8em Verdana }



Back To Learn More About CSS