CSS font-size Property


The font-size CSS property sets the font size for the element's text content.

  • xx-small − Sets the element's text to be a size smaller than that which results from the value x-small.

  • x-small − Sets the element's text to be a size smaller than that which results from the value small.

  • small − Sets the element's text to be a size smaller than that which results from the value medium.

  • medium − Sets the element's text to be a size smaller than that which results from the value large, and larger than that which results from the value small.

  • large − Sets the element's text to be a size larger than that which results from the value medium.

  • x-large − Sets the element's text to be a size larger than that which results from the value large.

  • xx-large − Sets the element's text to be a size larger than that which results from the value x-large.

  • larger − Sets the element's text to be larger than that of its parent.

  • smaller − Sets the element's text to be smaller than that of its parent.

  • length − Any permitted length value. Negative length values are not permitted for font-size.

  • percentage − Sets the element's text size relative to that of its parent.

CSS Syntax

font-size:medium|xx-small|x-small|small|large|x-large|xx-large|smaller|larger|length|initial|inherit;

Supported Browsers:

  • Firefox: 52.0, 2.0 -moz-
  • Google Chrome: 50.0, 4.0 -webkit-
  • Internet Explorer: 10.0
  • Safari: 9.0, 3.1 -webkit-
  • Opera: 37.0, 15.0 -webkit-, 11.1

Example -