HTML – Fonts Reference

Fonts play a crucial role in web design, allowing developers to create visually appealing and engaging websites. With HTML, you have a range of options to customize the appearance of your text using different font families, sizes, styles, and more. In this reference guide, we’ll explore various HTML font-related tags and attributes to help you enhance your web typography skills.

Font Families

HTML provides a set of font families that you can use to style your text. Here are a few examples:

  • Serif Fonts: Times New Roman, Georgia, serif.
  • Sans-Serif Fonts: Arial, Verdana, sans-serif.
  • Monospaced Fonts: Courier New, Consolas, monospace.

To specify the font family for an HTML element, use the font-family CSS property or the face attribute within the deprecated font tag.

Font Sizes

You can control the size of your text using different units of measurement. Some commonly used units include pixels (<strong>px</strong>), ems (<strong>em</strong>), and percentages (<strong>%</strong>). For example:

<p style="font-size: 16px;">This text has a font size of 16 pixels.</p>
<p style="font-size: 1.2em;">This text has a font size of 1.2 times the parent element's font size.</p>
<p style="font-size: 80%;">This text has a font size of 80% of the parent element's font size.</p>

Font Styles

HTML allows you to apply different styles to your text, such as bold, italic, and underline. Here’s how you can use them:

  • Bold: <strong> or <b> tags.
  • Italic: <em> or <i> tags.
  • Underline: <u> tag.
<p>This is <strong>bold</strong> text.</p>
<p>This is <em>italic</em> text.</p>
<p>This is <u>underlined</u> text.</p>

Google Fonts

In addition to the standard fonts, you can utilize Google Fonts to expand your font choices. Google Fonts provides a wide selection of free, open-source fonts that you can easily integrate into your web projects. To use Google Fonts, include the following code in the <head> section of your HTML file.

<link rel="stylesheet" href="|Font2|Font3">

Replace Font1, Font2, and Font3 with the names of the desired fonts from the Google Fonts library. Then, you can use these fonts by specifying the font family in your CSS or HTML code.

<link rel="stylesheet" href="|Roboto">

  p {
    font-family: 'Open Sans', sans-serif;
    font-size: 18px;
    font-weight: bold;

  h1 {
    font-family: 'Roboto', sans-serif;
    font-size: 24px;
    font-style: italic;

<p>This paragraph uses the Open Sans font.</p>
<h1>This heading uses the Roboto font.</h1>

Remember to replace Font1 and Font2 with the names of the desired Google Fonts.

By using these HTML font-related tags and attributes, along with external font libraries like Google Fonts, you can greatly enhance the visual appeal of your web pages. Experiment with different combinations and find the typography that best suits your design and content.