CSS font-size Property


The font-size CSS property is used to specify the font size of text in an HTML document.

Syntax

Example

Preview

Property Values

Value Description
medium Set the font size to medium. This is the default setting.
xx-small Set the font size to xx-small.
x-small Set the font size to extra small.
small Set the font size too small.
large Sets the font size too large.
x-large Set the font size to extra large.
xx-large Set the font size to xx-large.
smaller Sets the font-size to be less than that of the parent element.
larger Sets the font-size to be larger than the parent element's size.
length Sets the font-size to a fixed value in px, cm, and so on. Learn more about length units.
% Sets the font-size to a percentage of the font-size of the parent element.
initial This property is set to its default value.
inherit This property is inherited from its parent element.

Supported Browsers

Element Chrome Firefox Safari Edge / IE Opera
font-size 1.0 1.0 1.0 5.5 7.0