To change the font color of text in HTML, you can use the “color” attribute in a style element or inline style. Here are the steps to change the HTML font color:
- Open your HTML file in a text editor or code editor.
- Find the text that you want to change the color of.
- Add the “style” attribute to the HTML tag that contains the text. For example, if the text is inside a paragraph tag, you would add the style attribute to the opening paragraph tag.
- In the style attribute, add the “color” property and specify the desired color value. The color value can be a color name (e.g. “red”), a hexadecimal color code (e.g. “#FF0000”), or an RGB color value (e.g. “rgb(255, 0, 0)”).
- Save the HTML file.
Here is an example of how to change the font color of text using inline style:
css
<p style="color: red;">This text will be red</p>
Here is an example of how to change the font color of text using a style element:
php
<head>
<style>
p {
color: blue;
}
</style>
</head>
<body>
<p>This text will be blue</p>
</body>
In the above example, the color of all paragraph text will be set to blue using the style element in the head section of the HTML document.