HTML Code for Change text color

Introduction to Changing Text Color in HTML

In HTML, you can easily change the text color using the 'color' attribute within the 'style' tag or using inline CSS.

Using the style Tag to Change Text Color

To change the text color of an entire paragraph or a specific section of text, you can use the 'style' tag with the 'color' attribute. Here's an example:

Using Inline CSS to Change Text Color

Alternatively, you can also use inline CSS to change the text color. This method is useful when you want to apply unique styles to individual elements. Here's how you can achieve this:

Example Code

<p style="color: red;">This is a red text</p>

Go from files to website in seconds.

Start a free trial for 7 days — no credit card required

Get Started for Free