.... value can be a hexadecimal value (starting with #), an rgb value, an rgba value, or a color name."/> .... value can be a hexadecimal value (starting with #), an rgb value, an rgba value, or a color name.">
Home >Web Front-end >HTML Tutorial >How to set font color in html
<p>To set the font color in HTML, use the color attribute, whose syntax is:<p>... . value can be a hexadecimal value (starting with #), an rgb value, an rgba value, or a color name.
color
attribute.
<p>Syntax:
<code><element style="color: value;"> ... </element></code><p>Among them:
element
is to set the font color Elements. value
is the value of the color, which can be in the following formats:
<code><p style="color: #FF0000;">这是一个红色的段落。</p></code><p>Use rgba Value sets the title text to semi-transparent blue:
<code><h1 style="color: rgba(0, 0, 255, 0.5);">这是一个半透明的蓝色标题。</h1></code><p> Note: The
color
attribute can be applied to any HTML element, such as <p>
, <h1>
, div
, etc. color
attribute in a stylesheet, it will override any inline styles set within the HTML element. The color
properties can also be used to set other text styles, such as font weight, font size, and alignment. 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!