3 Way to Change Your Text Color

Share This Post

There is no special HTML color tag, as the design is not the main function of HTML. Coloring your text is a part of CSS inline style. It means you need to use the style attribute in the open tag you wish to add HTML color too.

You may use the color property to change the color of your text, to change the color this property takes color namesRGBRGBAHEXHSL, or HSLA values.

How to change the text color?


An RGB color value is used in HTML or CSS to define a color on a web page. The RGB color value is a mix of three color combinations. R means red color, G means Green color, and B means blue. Each of the colors combines (R, G, and B) is a value between 0 and 255 in decimal.


<span style="background-color:rgb(255, 99, 71)" class="tagcolor">This is heading</span>

In the above example, you can replace the tag of span, <p> tag:

Color Attribute

change the color for all text of an <p> element to:

p { 
color: green; 
background-color:rgb(255, 99, 71);

Style direct in HTML tag

To change the color in HTML, you can use the style attribute. The style attribute specifies an inline <style> for an element. The attribute use with the HTML <p> tag, with the CSS property color.

<h4 style="color: white;">This is heading</h4>
<p style="color: black">This is paragraph</p>

Read  more: 3 Ways to Bring Your Image In The Center Using HTML


Related Posts

Python for Loop Iteration: How to Easily Manipulate a List

One of the most powerful features of the Python...

How To Get First Characters of a String in Python

Way to find the first characters of a string...

How To Convert Tuple To String In Python

In this post, you will learn how to convert...

How To Convert String to Double in Python

Good to hear, that you want to convert a...

Python TypeError: String Index Out Of Range Solution

A string is an array of characters and part...

How To Remove Empty Strings From a List Of Strings

On this page, we will discuss how to remove...
- Advertisement -spot_img