Attribute – Font Color Attribute

Font Color Attribute

This attribute is used to set a color to the text enclosed in a <font> tag.


<font color= "color">


This attribute is not supported in HTML5. Instead, this Codevarsity article specifies a CSS method, which can be used.


A color can also be specified using a ‘hex code’ or an ‘rgb code’, instead of using a name.


In this example we can see how to set green colour to the text enclosed in a <font>tag. There are three options:

  1. Color name attribute
<html> <body> <font color="green">Font color example using color name</font> </body> </html>
  1. Hex code attribute
<html> <body> <font color="#00FF00">Font color example using hex code</font> </body> </html>
  1. RGB attribute
<html> <body> <font color="rgb(0,255,0)">Font color example using RBG</font> </body> </html>
  1. HSL attribute
<html> <body> <font color="hsl(80, 90%, 75%)">Font color example using color attribute</font> </body> </html>

This article needs improvement. You can help improve this article. You can also write similar articles and help the community.