HTML Font Color | Text Color Codes, Tag, Css Style

Change the HTML Text color is very easy. Actually, the text is a common word but in HTML, you have to use it HTML Font Color change. Because of the font keyword used for any style, color, size word used in CSS to change on TEXT. So remember it any change on text color in HTML used a “Font Keyword” property.

But “Font” is also a Tag in HTML. Which can use any content type tag.

Don’t confuse will with Font And Text we will discuss completely everything in this tutorial.


A simple syntax of html font color.

<font color=”color_name|hex_number|rgb_number“>

A html text color syntax.

<tagname style=”property:value;“>

Example | HTML “Font” color codes

Font tag can be use with any tag to change the color of text. See the below code example how to do it.

First we are using a <p> and then inside it use <font> tag. First HTML font color is red and next is blue color text. Where color=”red” is an attribute of <font> element.

Note: If color attribute of <font> is not supported in HTML5 then Use CSS.


Example HTML Font color codes

Example | HTML text color codes

Use Style Attribute with Color Property in text content tags like <h1>, <p> etc. In color property, there is 3 option to change the text color in HTML. See below example changing the color with color_name value.


Example HTML text color codes

Color Attribute Values

A below type of value you can add in color attribute when changing a text color in HTML.

color_nameSet the text color with a color name (like “red”)
hex_numberset the text color with a Hex code (like “#ff0000”)
rgb_numberset the text color with an RGB code (like “rgb(255,0,0)”)

Let’s see an example of how we can add the value in color attribute different ways.


How to change HTML font color with CSS

Upper example is used inline CSS, you can do with the same thing with Internal/External CSS. Let’s see the example for internal CSS.

HTML text color CSS | Style

Same as above example and it is recommend ways to do the style and color change of text in HTML.

See below example of html text color style code.

Interview Question: This tutorial can be your interview question like – How to change text color in HTML? OR HOW to change font color in HTML?

Q: Which HTML text color tag is used for change text(Paragraph, Sentence, Heading etc) color.

Answer: A <font> tag with color attribute is used for change the text color in HTML. for exmaple:-

<p><font color=”color_name“></P>

Do comment if you have any doubt and suggestions on this tutorial.

Note: The changeHTML Text/Font Color Examples are tested on Safari browser (Version 12.0.2).
OS: macOS 10.14 Mojave
Code: HTML 5 Version

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.