Home HTML 3 Way to Change Your Text Color

3 Way to Change Your Text Color


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


Please enter your comment!
Please enter your name here