Fandom

HTML & CSS Wiki

Font-size

649pages on
this wiki
Add New Page
Comments3 Share

The font-size property is used in CSS and certain HTML elements. It is used to specify the size of the font.

Values

  • xx-small, x-small, small, medium, large, x-large, xx-large - These are a set of absolute size keywords based on the user's default font size (medium). Similar to the HTML <font></font> element.
  • larger or smaller - Renders font larger or smaller than the parent element's font size, by roughly the ratio used to separate the absolute size keywords mentioned above.
  • A length measurement, such as em, px, or pt - These are units of measurement to be placed after the initial digits wanted. Ex. 12pt.
  • A positive percentage value, such as 2% or 5%.


To apply this in HTML, use:

<span style="font-size:xx-small;">XX-small font.</span>

Which will produce: XX-small font.


This is text using the larger value: Larger font.

This is text using the smallervalue: Smaller font.

This is text using a 14pt measurement: 14pt font.

This is text using a 12em measurement: 12em font.

This is text using a 10px measurement: 10px font.

This is text using an 8% measurement: 8% font.


To apply this in CSS, in the h1 element for example, use:

h1 {
     font-size:12pt;
}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.