banner



How Do You Change The Color Of Text In Html?

How to Change Text Color in Html

In HTML, we tin change the color of any text using the following different ways:

  1. Using HTML tag
  2. Using an Inline style attribute
  3. Using internal CSS

1. Using HTML tag

Note: HTML 5 does non support the color aspect of font, so we have to use the inline style attribute and internal CSS options for changing the colour of a text.

If we desire to alter the color of a text using Html tag which is to exist displayed on a web page, we have to follow the steps which are given below. Using these steps, we tin can hands change the colour of any text:

Stride 1: Firstly, we accept to type the Html code in any text editor or open the existing Html file in the text editor in which we want to use the Html tag.

Step 2: At present, motion the cursor at the starting of that text whose colour we want to alter. And then, type the empty Html <font> tag at that position.

Stride 3: So, we have to close the font tag at the end of the text whose color nosotros want to change.

Stride 4: Now, we accept to add the attribute of the font tag whose name is "color". So, type the color attribute within the starting <font> tag. And, then we have to requite the color which we want to use on the text. So, type the proper name of color in the color attribute as described in the following block.

Test it Now

Pace 5: And, at final, we have to salvage the Html lawmaking in the text editor and run the code. Afterwards execution, we will come across the output in the browser. The following screenshot shows the output of the to a higher place Html Code:

How to Change Text Color in Html

2. Using an Inline Manner attribute

If we want to change the colour of a text using an inline manner attribute which is to be displayed on a web folio, we take to follow the steps which are given beneath. Using these steps, we can easily change the color of text.

Step 1: Firstly, we accept to type the Html lawmaking in any text editor or open the existing Html file in the text editor in which we want to use the style attribute for changing the color of a text.

Stride ii: Now, move the cursor at the starting of that text whose color we want to alter. And and so, type the inline style attribute within any element. Here, nosotros utilise the <p> (paragraph) tag:

Stride 3: In this step, we accept to give a name of color as a value. We can give the color proper noun in iii forms:

  1. We can type the name of a color
  2. Nosotros can likewise enter the RGB value of a color
  3. Nosotros tin can also enter the hexadecimal value of a color.

Step 4: And then, we have to close the element at the terminate of the text whose colour we desire to change.

Footstep iv: And, at concluding, salve the Html code which changes the text colour using the CSS style attribute.

Test it Now

The output of the to a higher place lawmaking is shown in the following screenshot:

How to Change Text Color in Html

two. Using Internal CSS

If nosotros want to change the color of a text using an internal cascading stylesheet which is to exist displayed on a spider web folio, we have to follow the steps which are given below. Using these steps, we tin easily change the color of text.

Step 1: Firstly, we have to type the Html code in whatever text editor or open up the existing Html file in the text editor in which we want to use the internal CSS for changing the color of a text.

Step two: Now, we have to place the cursor in the caput tag of the Html document and then define the styles inside the <style> tag as shown in the following cake. And, then type the color attribute into the element selector.

Step 3: Now, nosotros accept to blazon the defined chemical element selector before the text whose color we want to change.

Examination information technology Now

The output of the above Html lawmaking is shown in the post-obit screenshot:

How to Change Text Color in Html

How Do You Change The Color Of Text In Html?,

Source: https://www.javatpoint.com/how-to-change-text-color-in-html

Posted by: kingtordese.blogspot.com

0 Response to "How Do You Change The Color Of Text In Html?"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel