HTML Tag


The <font> tag in HTML is used to set font color, font family and font size. Following is the attributes −

  • color: Set the color of the font.
  • face: Set the font face i.e. family.
  • size: Set the font size

Note − The <font> tag isn’t supported in HTML5.

Let us now see an example to implement the <font> tag in HTML −

Example

 Live Demo

<!DOCTYPE html>
<html>
<body>
   <h2>Playing with Fonts</h2>
   <p>Displaying different fonts below:</p>
   <p><font face="arial" size="20" color="yellow">Demo Text!</font></p>
   <p><font size="10" color="gray">Demo Text!</font></p>
   <p><font size="15" face="verdana" color="magento">Demo Text!</font></p>
   <p><font size="8" face="calibri" color="magento">Demo Text!</font></p>
</body>
</html>

Output

In the above example, we have set the font using the font tag attributes −

<font size="8" face="calibri" color="magento">
   Demo Text!
</font>

Above, we have set the font size with −

font size="8"

We have set the font face with face attribute −

font face="calibri"

The font color with color attribute −

font color="magento"

Updated on: 29-Jun-2020

113 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements