HTML <font> Tag

The <font> element defines the font size, face and color for its content.

It allows to change any of the font attributes at any time. You can change one or all of the font attributes within one <font> tag.

Syntax

The <font> element comes in pairs. The content must be written between the opening (<font>) and closing (</font>) elements.

Note: The <font> tag is not used anymore after HTML5. Use CSS-text instead of this element.

Recommendation: Learn more about how to give style to your fonts with CSS.

Example

<!DOCTYPE html>
<html>
   <body>
      <p>
         <font size="2" color="blue">This is a text with blue color.</font>
      </p>
      <p>
         <font size="3" color="red">This is a text with red color and bigger.</font>  
      </p>
      <p>
         <font face="arial" color="green">This is a text in different font style and with green color.</font>
      </p>
   </body>
</html>

Use CSS color property instead of color attribute, CSS font-family property or CSS font-face property instead of face attribute and CSS font-size property instead of size attribute.

Example

<!DOCTYPE html>
<html>
   <body>
      <p style="font-size:16px;color:blue">This is a text with blue color.</p>
      <p style="font-size:18px;color:red"> This is a text with red color and bigger. </p>
      <p style="font-size:18px;color:green;font-family:arial">  This is a text in different font style and with green color. </p>
   </body>
</html>

Result


Optional Attributes:

Attributes Value Description
color rgb (x, x, x)
#xxxxxx
colorname
Defines text color.
face font_family Defines text font style.
size number Defines text size.

The <font> element also supports the Global Attributes.