Home > Article > Web Front-end > How to change font color in html
The font color can be changed in HTML by modifying the HTML code directly, using the <font> tag and the color attribute. Use CSS stylesheets to set colors via the color property or RGB/hex color codes.
HTML How to change the font color
Modify the HTML code directly
<font>
tag whose color
attribute specifies the font color. For example: <font color="red">red text</font>
. Using CSS
CSS style sheets are a more modern, organized way to modify font color.
color
attribute: <span style="color: red;">red text</span>
. <style>
Tags: <code class="html"><style> .red { color: red; } </style></code>
<span class=" red">red text</span>
. Using RGB values
You can specify font color using RGB color codes. For example:
Using Hexadecimal Values
You can also specify font color using hexadecimal color codes. For example:
Make sure your browser supports the font color attribute and value you use.
rgb()
bracket (RGB).
Consider using CSS as it provides better scalability and maintainability. The above is the detailed content of How to change font color in html. For more information, please follow other related articles on the PHP Chinese website!