HTML font color

The Color is an attribute of tag, which specifies the text color.

Syntax

We can specify the text color with the following different attribute values:

  • Color_name: This value sets the color of a text by the name of a color.

Example:

  • Rgb_number: This value sets the color of a text by the RGB code.

Example:

  • Hex_number: This value sets the color of a text by the hex code.

Examples: The following examples use the different value of color attribute:

Example 1: The following example uses the name of a color:

Test it Now

Output:

HTML font color

Example 2: The following example uses the hex code for defining the text color:

Test it Now

Output:

HTML font color

Example 3: The following example uses the rgb number for defining the text color:

Test it Now

Output:

HTML font color

Example 4: The following example uses all the attribute values for the font color.

Test it Now

Output:

HTML font color

Browser Support

Element chrome browser Chrome ie browser IE firefox browser Firefox opera browser Opera safari browser Safari
Yes Yes Yes Yes Yes

Next TopicHTML Font Size




Contact US

Email:[email protected]

HTML Font Color
10/30