font

The font property is a shorthand property for setting font-style, font-variant, font-weight, font-size, line-height, and font-family.

font: [[ <'font-style'> || <'font-variant'> || <'font-weight'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar | inherit
Initial: normal, normal, normal, medium, normal, depends on user agent
Applies To: all elements
Inherited: yes
Percentages: NA, except font-size refers to parent element's font size and line-height refers to the font size of the element itself
Media: visual

Values

Δ

font: value;
 
Value: Description:
absolute-size Index to a table of font sizes: xx-small | x-small | small | medium | large | x-large | xx-large
bold 700 in the ordered sequence
bolder Bolder relative to the weight inherited from the parent
caption Font used for captioned controls (buttons, drop-downs, ...)
family-name Name of a font family of choice
generic-family Name of a generic font family as an alternative
icon Font used to label icons
inherit Takes the same computed value as the property for the element's parent
italic Cursive font which is slanted to the right
length Horizontal or vertical measurements: em | ex | px | in | cm | mm | pt | pc
lighter Lighter relative to the weight inherited from the parent
menu Font used in menus (dropdown menus and menu lists)
message-box Font used in dialog boxes
normal Upright font
normal 400 in the ordered sequence
normal Not a small-caps font
normal "Reasonable" value based on the font of the element
number Number multiplied by the element's font-size
oblique Normal font which is slanted to the right
percentage Value relative to the inital value
percentage Percentage multiplied by the element's font-size
relative-size Relative to the table of font sizes and the font size of the parent element: smaller | larger
small-caps Lower case letters look similar to the uppercase ones, but in a smaller size and with slightly different proportions
small-caption Font used for labeling small controls
status-bar Font used in window status bars

DOM

Δ

[window.]document.getElementById("element-id").style.font = "font";

Example | Values | caption

Δ

Example | Values | font-family | family-name

Δ

Example | Values | font-family | generic-family

Δ

Example | Values | font-size | absolute-size

Δ

Example | Values | font-size | length

Δ

Example | Values | font-size | percentage

Δ

Example | Values | font-size | relative-size

Δ

Example | Values | font-style | italic

Δ

Example | Values | font-style | normal

Δ

Example | Values | font-style | oblique

Δ

Example | Values | font-variant | normal

Δ

Example | Values | font-variant | small-caps

Δ

Example | Values | font-weight | 100-900

Δ

Example | Values | font-weight | bold

Δ

Example | Values | font-weight | bolder

Δ

Example | Values | font-weight | lighter

Δ

Example | Values | font-weight | normal

Δ

Example | Values | icon

Δ

Example | Values | line-height | length

Δ

Example | Values | line-height | normal

Δ

Example | Values | line-height | number

Δ

Example | Values | line-height | percentage

Δ

Example | Values | menu

Δ

Example | Values | message-box

Δ

Example | Values | small-caption

Δ

Example | Values | status-bar

Δ

Example | DOM

Δ

References

Δ