banner



How To Change The Color Of A Single Word In Html

How to Change Text Color in Html

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

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

one. Using HTML tag

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

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

Step one: Firstly, we take to type the Html code in whatsoever text editor or open the existing Html file in the text editor in which we want to utilize the Html tag.

Step 2: Now, move the cursor at the starting of that text whose color we desire to change. Then, type the empty Html <font> tag at that position.

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

Step 4: Now, we have 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 give the colour which we desire to use on the text. And so, type the proper noun of colour in the color attribute equally described in the post-obit block.

Examination it Now

Step 5: And, at last, nosotros have to save the Html code in the text editor and run the code. Later on execution, we will see the output in the browser. The following screenshot shows the output of the higher up Html Code:

How to Change Text Color in Html

2. Using an Inline Style attribute

If we want to alter the color of a text using an inline style attribute which is to be displayed on a web page, we have to follow the steps which are given below. Using these steps, nosotros can easily change the color of text.

Footstep 1: Firstly, we have to type the Html code in whatever text editor or open the existing Html file in the text editor in which nosotros want to use the manner attribute for changing the colour of a text.

Pace ii: Now, motion the cursor at the starting of that text whose color we desire to change. Then, type the inline style attribute within any element. Hither, we apply the <p> (paragraph) tag:

Step iii: In this stride, we take to requite a proper name of color equally a value. We can requite the colour proper noun in iii forms:

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

Step 4: Then, we have to close the chemical element at the cease of the text whose color we want to change.

Step 4: And, at last, salve the Html code which changes the text colour using the CSS style attribute.

Exam it Now

The output of the above code is shown in the following screenshot:

How to Change Text Color in Html

ii. Using Internal CSS

If we desire to modify the color of a text using an internal cascading stylesheet which is to be displayed on a spider web page, we accept to follow the steps which are given below. Using these steps, we tin can easily change the color of text.

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

Footstep 2: At present, we accept to identify the cursor in the head tag of the Html document and then define the styles inside the <style> tag as shown in the following block. And, so type the color attribute into the element selector.

Step 3: Now, we have to type the divers element selector before the text whose color we want to change.

Exam information technology At present

The output of the in a higher place Html code is shown in the post-obit screenshot:

How to Change Text Color in Html

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

Posted by: byrnehapingrese1948.blogspot.com

0 Response to "How To Change The Color Of A Single Word In Html"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel