HTML font

Updated: 11/30/2020 by Computer Hope

On a web page, an HTML font or web font is the type of text displayed, designated using CSS (cascading style sheets). In the past, aspects of the font could be changed using attribute and value pairs in the <font> tag. However, in this tag was deprecated in HTML (hypertext markup language) 4.1, and will soon be obsolete. The following sections contain examples of both methods, and information on how to get more web fonts.

HTML fonts in CSS

For HTML5 and website design in general, we recommend CSS be used to specify the font. The following example specifies the body to use Verdana if available, Arial as a fallback, and the color code #333. With CSS, the font-family and color can by applied directly to any specific HTML element, or added to a certain HTML tag using a class or id.

body {
 font-family: verdana, arial;
 color: #333;
}

HTML fonts with font tag

Example code

<font face="verdana" color="green" size="+2">Verdana font in a green color</font>

Example result

Verdana font in a green color

Where can I get more web fonts?

One of the easiest methods for getting fonts for your web page is to use Google Fonts, a collection of thousands of fonts. These fonts are loaded from their fast and worldwide servers and can improve the look of your website.

  • See the Google Fonts page for a full listing of their available fonts.

CSS, Font, HTML tag, Internet terms, Web, Web design terms