CSS Font Size

How to set the font size in html using style sheet?

Explanation

Property :

Font Size

Usage:


font-size: xx-small;
font-size: x-large;
font-size: larger;
font-size: smaller;
font-size: 10px;
font-size: 80%;

Definition:


The size of the font can be controlled using this parameter in style sheet. The values can be set in three modes.
a) Absolute Size.
b) Relative Size.
c) Length - in percentage / pixels / points.
It takes the following values.
a)Absolute : The following absolute values can be used to set the size of the text. xx-small or x-small or small or large or x-large or xx-large or medium.
b)Relative : The following relative values can be used. larger or smaller
c)Length : In percentage (e.g 34%) or pixels (e.g: 20px) or points (e.g: 20).

Example 1:


<div style="font-size: xx-small;">testing font size </div>
Result:

testing font size


Example 2:


<div style="font-size: x-large;">testing font size </div>
Result:

testing font size


Example 3:


<div style="font-size: larger;">testing font size </div>
Result:

testing font size


Example 4:


<div style="font-size: smaller;">testing font size </div>
Result:

testing font size


Example 5:


<div style="font-size: 20px;">testing font size </div>
Result:

testing font size


Example 6:
<div style="font-size: 200%;">testing font size </div>
Result:

testing font size


Ask Questions

Ask Question