
While working on your website user interface many of you must have battled with whether or not we can change the color of a font to make it look more attractive. It is often required for highlighting some of the text parts to make it more eye catchy and grab the attention of the viewers.
In this blog, we are going to learn how to change the color text html of a paragraph, heading, or other elements.
You just have to follow some simple steps before you apply the css color property to change the text color of a paragraph or other elements.
| <p style= “color:green”> Welcome to PW Skills </p> |
| //Using the simple name value format
<p style= “color:green”> Welcome to PW Skills </p> //Using the Hex code color format<p style= “color:#00FF00”> Welcome to PW Skills </p> //Using the RGB Color format<p style= “color:rgb(0,255,0)”> Welcome to PW Skills </p> //Using the HSL Color format<p style= “color:(1200, 100%, 50%)”> Welcome to PW Skills </p> |
You can easily change the color using the inline color text html property with inline HTML tags.
| <!DOCTYPE html> <html> <head> <style> class_name { color: value; } </style> </head> // ... </html> |
| <!DOCTYPE html> <html> <head> <style> id_name { color: value; } </style> </head> // ... </html> |
Let us learn how we can apply the CSS color text html property to an element using the external styling.
For external styling you have to add the CSS styling to your CSS file with the class name or ID of the element you want to apply the color change. Check the simple syntax for how you can apply and put the particular CSS styling in your file.
| class/id { color: value; } |
| //HTML Code <p> Welcome to PW Skills </p> //color text html p { color: #00FF00; } |
| //HTML Code <p class=”paragraph” > Welcome to PW Skills </p> //CSS .paragraph { color: #00FF00; } |
| //HTML Code <p id=”paragraph” > Welcome to PW Skills </p> //CSS #paragraph { color: #00FF00; } |