How to html color text

Content on WhatAnswers is provided "as is" for informational purposes. While we strive for accuracy, we make no guarantees. Content is AI-assisted and should not be used as professional advice.

Last updated: April 4, 2026

Quick Answer: You can color text in HTML by using the `style` attribute with the `color` CSS property. For example, `<span style="color: blue;">This text is blue.</span>` will display the text 'This text is blue.' in blue.

Key Facts

Overview

Coloring text in HTML is a fundamental aspect of web design, allowing you to enhance readability, emphasize key information, and create a visually appealing user experience. While HTML itself provides the structure, it's Cascading Style Sheets (CSS) that handle the presentation, including text color.

Methods for Coloring Text in HTML

1. Inline Styles (Using the `style` Attribute)

The most direct way to color a specific piece of text is by using the `style` attribute directly within an HTML tag. This method is simple for one-off changes but can become difficult to manage for larger websites.

Syntax:

<tagname style="color: color_value;">Your text here</tagname>

Example:

<p style="color: blue;">This paragraph will be blue.</p><span style="color: green;">This specific phrase is green.</span>

2. Internal Stylesheets (Using the `