How to Use HTML Font Face Attribute


How to Use HTML Font Face Attribute

How to Use HTML Font Face Attribute

The font face attribute

The font-face attribute sets the font or font family for the text in the web pages. For example, the font names like Verdana, Arial etc can be set by using this attribute.

You may prioritize the font face by adding a space between different font names. If you have multiple font names, the first font will be checked first. If this is not available in user’s browser the next one will be applied and so on.

The example below shows how to use the Font-Face attribute in HTML <font> tag.

Experience this online



Note that, the font attribute is not supported in HTML 5 version. In order to set the font face of the text, use the font-family property of the CSS. An example of using the font-family property is given below:

Example of using the Font Family property

The following example shows how to use the font-family property of the CSS.

HTML font face

Experience this online



As you can see in the font-family property, you can specify the font names just like in font face attribute of the <font> tag. You can separate the font names by spaces to set the priority.

The last font name in the list should be one of five generic family names that are always available in the HTML and CSS. The five generic font names are:

  1. Serif
  2. Sans-serif
  3. Cursive
  4. Fantasy
  5. Monospace

Also see CSS font | HTML forms



Related Articles

Leave A Comment?