The way to set the font color in HTML is to use the color attribute provided by CSS. Color values support color names, hexadecimal color codes or RGB/RGBA Color values: Color names: for example red Hex color codes: starting with the # symbol, followed by six hexadecimal digits, for example #FF0000RGB/RGBA Color values: Use the rgb() or rgba() function, followed by three (RGB) or four (RGBA) arguments, representing the red, green, and blue (or alpha) components of the color.
How to set the font color in HTML
Setting the font color in HTML is very simple, you can use the CSS provided color
attribute.
Syntax:
<code class="css">element { color: color-value; }</code>
Where:
is the HTML element to set the font color.
is the color value to be set, which can be a color name, a hexadecimal color code, or an RGB/RGBA color value.
Example:
<code class="html"><p style="color: red;">这是一段红色的文本。</p></code>
Supported color values:
,
green,
blue, etc.
# symbol, followed by six hexadecimal digits, for example:
#FF0000 ( red),
#00FF00 (green),
#0000FF (blue).
or
rgba() function, followed by three (RGB) or four ( RGBA) parameters, each representing the red, green, and blue (or alpha) components of a color. For example:
rgb(255, 0, 0) (red),
rgb(0, 255, 0) (green),
rgba(0, 0, 255, 0.5 ) (blue, 50% transparency).
Note:
property, or using an external CSS file.
instead of
红.
The above is the detailed content of How to set font color in html. For more information, please follow other related articles on the PHP Chinese website!