On a web page, an HTML font or web font is the type of text displayed, designated using CSS. In the past, aspects of the font could be changed using attribute and value pairs in the tag. However, in this tag was deprecated in HTML 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.
- HTML fonts in CSS
- HTML fonts with font tag
- Where can I get more web fonts?
- Related information
body { font-family: verdana, arial; color: #333; }
HTML fonts with font tag
Example code
Verdana font in a green color
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
Related information
- How to change the font type, size, and color on a web page.
- HTML and web design help and support.