How To Set Font Color In Html
How to Change Text Colour in Html
In HTML, we can change the color of whatsoever text using the following unlike means:
- Using HTML tag
- Using an Inline style attribute
- Using internal CSS
ane. Using HTML tag
Annotation: HTML 5 does not support the colour attribute of font, and so nosotros accept to apply the inline fashion attribute and internal CSS options for changing the color of a text.
If we want to alter the colour of a text using Html tag which is to be displayed on a web page, we accept to follow the steps which are given below. Using these steps, we tin can hands change the colour of any text:
Step 1: Firstly, we have to type the Html code in any text editor or open the existing Html file in the text editor in which nosotros want to utilize the Html tag.
Footstep 2: Now, move the cursor at the starting of that text whose color nosotros desire to change. And and then, type the empty Html <font> tag at that position.
Pace 3: And then, we have to close the font tag at the cease of the text whose color we desire to modify.
Footstep 4: Now, nosotros have to add the attribute of the font tag whose proper noun is "colour". So, type the colour attribute inside the starting <font> tag. And, then we have to give the colour which we want to use on the text. So, blazon the proper name of color in the color attribute as described in the following block.
Test it NowStep 5: And, at final, nosotros have to save the Html code in the text editor and run the code. Later execution, we will see the output in the browser. The following screenshot shows the output of the above Html Code:
2. Using an Inline Mode aspect
If we desire to alter the color of a text using an inline style aspect which is to be displayed on a web folio, nosotros have to follow the steps which are given beneath. Using these steps, we can hands change the color of text.
Footstep ane: Firstly, we have to type the Html code in any text editor or open the existing Html file in the text editor in which we want to utilise the style attribute for changing the colour of a text.
Step ii: Now, move the cursor at the starting of that text whose color we want to alter. And then, type the inline style attribute within any element. Hither, we use the <p> (paragraph) tag:
Footstep three: In this step, we accept to give a name of colour as a value. We can give the color name in three forms:
- We tin can type the proper noun of a colour
- Nosotros can also enter the RGB value of a colour
- We tin likewise enter the hexadecimal value of a colour.
Step 4: Then, we have to shut the element at the end of the text whose color we want to change.
Stride 4: And, at last, save the Html code which changes the text color using the CSS fashion attribute.
Test it NowThe output of the above code is shown in the following screenshot:
two. Using Internal CSS
If we want to change the colour of a text using an internal cascading stylesheet which is to be displayed on a web page, we have to follow the steps which are given below. Using these steps, we can easily change the color of text.
Stride one: Firstly, we have to type 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.
Step ii: Now, we have to place the cursor in the head tag of the Html document and then define the styles inside the <style> tag every bit shown in the following block. And, and then type the color attribute into the element selector.
Step 3: At present, nosotros accept to type the defined element selector before the text whose color we want to alter.
Test it NowThe output of the higher up Html code is shown in the following screenshot:
How To Set Font Color In Html,
Source: https://www.javatpoint.com/how-to-change-text-color-in-html
Posted by: savoiefurepought.blogspot.com
0 Response to "How To Set Font Color In Html"
Post a Comment