Name
font-size
Synopsis
As the name suggests, the font-size property
specifies the size of the text element. There are four methods for
specifying font size:
-
absolute size Values:
xx-small|x-small|small|medium|large|x-large|xx-largeExample:
H1 {font-size: x-large}Absolute sizes are descriptive terms that reference a table of sizes kept by the browser.
-
relative size Values:
larger|smallerExample:
H1 { font-size: larger }These values specify the size of the type relative to the parent object.
-
length Values:
number+em|ex|px|pt|pc|mm|cm|inExample:
H1 {font-size: 24pt}You can also specify font size using any of the length values described in Section 17.4.1 earlier in this chapter.
-
percentage Values:
n%Example:
H1 {font-size: 125%}This specifies font size as a percentage of the inherited size. For instance, in this example the H1 will be 125% larger than the size of regular body text.
Values:
absolute size|relative size|length|percentageApplies to:
All elements
Inherited:
Yes
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access