CSS font-size property Example

Updated on     Kisan Patel

The CSS font-size property is used to specify the size of the font. You can specify the font-size in points (pt), pixels (px) or in percentage (%).

We can also specify the font size using the relative values such as small, medium, large. The disadvantage of using such relative sizes is that one cannot have the strict control over the font-size. Different browsers may have different font size values.

Syntax

/* relative-size values */
font-size: larger;

/* length values */
font-size: 12px;
font-size: 0.8em;

/* percentage values */
font-size: 80%;

Example

h1
{
 font-size: 10pt;
}
h2
{
 font-size: 20px;
}
h3
{
 font-size: xx-large;
}
h4
{
 font-size: 250%;
}


CSS

Leave a Reply