The tag for HTML text color

In older websites, the <font color=’red’> tag was used to color text. However in modern times, it has changed. The styling (color, font and other presentation features) has to go in the CSS (Cascaded Style Sheet).

So,

There is no color tag in HTML !

If you see any website giving advice to use <font> tag to change text color, then it is outdated advice.

So, How to change text color in HTML?

One way is to create a common class for all such texts and create a CSS class for that. Like this:

.important-text
{
color: red;
}

Put that CSS code in your stylesheet.

Then use it in your HTML code like this.

This is some sample text. 
<span class="important-text">This is the important point</a> 
I wanted to highlight.

Now you can use that same CSS class wherever you want to high light the important text. Easy and elegant right?

Illustration

html text color illustration

The not so elegant but working Hack

An alternative, is you can’t use CSS for some reason, is to use inline CSS in the HTML tag.
Like this:

This is some sample text. 
<span style="color:red">This is the important point</a> 
I wanted to highlight.

Reference

more examples of text color code in HTML

Close

Copy and paste this code to display the image on your site

Copied!