How to change a Font color in HTML
In this tutorial, we are going to learn about how to change a font color in html by using the css style attribute.
Changing the font color
To change the font color in html, we can use the css style
attribute followed by the css property color:red;
.
Here is an example, that changes the <p>
element font color to red
:
<p style="color:red;">This is red color</p>
other example:
<h1 style="color:green;">This is green color</h1>
Note: By using the css
style
attribute inside the html element, previous applied styles to that element are removed.