font-size

font-size Description:

The font-size property defines the size of the font.

font-size in CSS Versions:

  • CSS 1
  • CSS 2
  • CSS 3

font-size Syntax:

font-size: <absolute-size> | <relative-size> | <length> | <percentage> | inherit

  • absolute-size
    This is referencing a table of font sizes computed by the user-agent. Possible values are:
    • xx-small
    • x-small
    • small
    • medium
    • large
    • x-large
    • xx-large
  • relative-size
    This is a keyword referencing a relative size relative to the parent font's size.
  • length
    A numerical value.
  • percentage
    This is a percentage based on the parent font's size.
  • inherit
    The element should have the same font-size setting as the parent.

font-size Initial Value:

medium

font-size Applies To:

All elements.

font-size Inheritance:

This property is inherited.

font-size Browser Support:

  • Netscape 4, 6, 7
  • Mozilla 1
  • Firefox 1
  • Internet Explorer 3, 4, 5, 6
  • Opera 3, 4, 5, 6, 7, 8
  • Safari 1

font-size Examples:

absolute size

<p style="font-size : x-large;">
 This paragraph is extra large.
 </p>
relative size
<p style="font-size : smaller;">
 This paragraph is smaller than the base font size.
 </p>

length

<p style="font-size : 1.5em;">
 This paragraph is 1.5 ems.
 </p>

font-size Special Notes

  • Negative values are not allowed.
  • If you use exact units for your font size (such as 5px or 15pt), do not leave any whitespace between the number and the unit. Otherwise, some browsers may completely disregard the style call.

    More font-size Information

    • font
    • font-family
    • font-style
    • font-variant
    • font-weight
    • Changing Font Attributes
    • How To Change the Font

    Return to the Style Library