The font color in HTML can be modified by using the <font> tag. The "color" attribute inside the tag accepts a color name or a hexadecimal color code starting with "#". For example, the code to color text red is red text .
How to modify the HTML font color
It is very simple to modify the font color in HTML. Just use the <font>
tag.
<code class="html"><font color="color_name">文本</font></code>
Where "color_name" can be a CSS color name (such as "red" or "blue") or a hexadecimal color code (starting with "#", such as "#FF0000").
For example, to color text red, you would use the following code:
<code class="html"><font color="red">红色文本</font></code>
Use hexadecimal color codes
Generally, it is recommended to use Hexadecimal color codes because they are more accurate and more compatible than color names. To find hexadecimal color codes, you can use online tools or view a list of CSS color values.
The following example colors text green using hexadecimal color codes:
<code class="html"><font color="#008000">绿色文本</font></code>
Note:
tag has been deprecated. It is recommended to use the CSS
or
tag to set the font color.
<code class="css">span { color: color_name; }</code>
attribute to the HTML element that contains the text.
The above is the detailed content of How to change html font color. For more information, please follow other related articles on the PHP Chinese website!