How To

How to Set Text Font in HTML

Contributor
By eHow Contributing Writer
(0 Ratings)

Fonts in an HTML document or web page can be changed with respect to typeface, size and color. Like most tasks in HTML, this is accomplished by placing an instruction known as a "tag" before and after the text that you want to affect.

Difficulty: Moderately Easy
Instructions

Things You'll Need:

  • Text file editor

    Set the Text Font in HTML Using the FONT tag

  1. Step 1

    Open up the web page you want to edit, then place the cursor in the place where you need to set text to a different font.

  2. Step 2

    Type the following:

  3. Step 3

    Type the text you want to appear with these attributes.

  4. Step 4

    Type the following right after the last character of your citation:

  5. Step 5

    Notice that your text now appears in red, 12-point Arial font. To change the text to your preferred style, simply replace the font size, color and font name with the appropriate entries.

  6. Set the Text Font in HTML using CSS

  7. Step 1

    Add the following attribute to the element, such as or

    , containing the text whose font you want to change:
    style="font-family: serif;"

  8. Step 2

    Replace sans-serif with the name of the font family you want, such as sans-serif, a specific font name such as Arial, or a list of font names separated by commas.

  9. Step 3

    Give the containing element a class attribute, and define CSS properties for that class in the