Search within TutorialsPark

CSS font-size Property


To specify the font-size for the block of text


Definition and Notes.

1. The CSS font-size property specifies the size of the font to be used to display a block of text.

2. The size can be defined as an absolute size, relative size, a length values, or a percentage value.

Table: font-size with absolute size keywords.

absolute-size xx-small x-small small medium large x-large xx-large
Scaling Index 3/5 3/4 8/9 1 6/5 3/2 2/1
Heading h6 h5 h4 h3 h2 h1

Syntax:

CSS font-size property. internetexplorer safari firefox opera chrome

View in Splitscreen»

Code-Editor:

Note-If you want your text to have font-size adaptive to its surroundings, then use percent units. .

Property Values

Value Description
xx-small The font-size is set to xx-small size
x-small The font-size is set to x-small size
small The font-size is set to small size.
medium The font-size is set to medium size.
large The font-size is set to large size.
x-large The font-size is set to x-large size.
xx-large The font-size is set to xx-large size.
smaller The font-size is set to smaller size.
larger The font-size is set to larger size.
length The font-size is set using length values(cm em px pt etc).
% The font-size is set using percentage values
inherit The font-size is inherited from parent element.

Specifications

Specs Value
Name font-size
Value xx-small | x-small | small | medium | x-large | xx-large | smaller | larger | <length> | <percentage>
Initial Value Medium
Applies to All elements
Javascript syntax object.style.fontSize="large"
Inherited Yes
Computed Value Calculated with respect to the parent element's font-size.
Browser Support internetexplorer safari firefox opera chrome

Related Examples.