Example

A simple font-size property example:

Laboratory

description & Usage

To determine the font size of the text, we use the font-size property.

Informations

# Description
Default Value medium
Inherited yes
Animatable yes
Version CSS1
JavaScript syntax object.style.fontSize="14px"

Browser compatibility and Support

# Chrome Edge Firefox Safari Opera
font-size

Syntax

Values

Values Description
medium default
xx-small Changes the font size to xx smaller.
x-small Makes the font size x smaller.
small Sets a small font size for the text.
large Sets the font size for the text.
x-large Changes the font size to x larger.
xx-large Changes the font size to xx larger.
smaller Sets the font size in terms of the smallest parent element.
larger Sets the font size in terms of the largest parent element.
length Determines the size in pixels, centimeters, etc.
% Specifies the size as a percentage.
initial Adds this value to its default property.
inherit It inherits this value from its parent tag.