To change the font color in HTML, use the CSS color property, whose syntax is: selector { color: color-value }. The color value can be a hexadecimal color code, an RGB color code, a color name, or an RGBA color code (with a transparency value).
How to change font color in HTML
Changing font color in HTML is very easy, just use CSS That’s it. CSS is a style sheet language that can be used to control the appearance of web pages.
Steps:
Specify the font color using the
color
property of CSS. The syntax is as follows:
selector { color: color-value; }
Where:
selector
is the selector of the HTML element.color-value
is the color value to apply.Types of color values:
There are many ways to specify color values:
#FF0000
(red).rgb(255, 0, 0)
(red).rgba(255, 0, 0, 0.5)
(translucent red).red
,green
,blue
.Example:
The following example changes the text color in all
elements to red:
这是一段红色的文本。
Tip:
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!