Red text
. Different colors can be set: red, blue, green, hexadecimal code (#ff0000) or RGB value (rgb(255, 0, 0))."/> Red text. Different colors can be set: red, blue, green, hexadecimal code (#ff0000) or RGB value (rgb(255, 0, 0)).">Home >Web Front-end >HTML Tutorial >How to set font color in html
Set font color in HTML using the color attribute, which can take a color name, hexadecimal code, or RGB value. Syntax:
red text
. Different colors can be set: red, blue, green, hexadecimal code (#ff0000) or RGB value (rgb(255, 0, 0)).
Set font color in HTML
How to set font color:
In HTML, you can use the color
attribute to set the font color of text. The value of this property can be a color name (for example, red
, blue
), a hexadecimal code (for example, #ff0000
), or an RGB value (for example, , rgb(255, 0, 0)
).
Syntax:
<code><p style="color: red;">红色文本</p></code>
Examples:
The following are some examples of setting different font colors:
<p style="color: red;">Red text</p>
<p style=" color: blue;">Blue text</p>
<p style="color: green;">Green text</p>
<p style="color: #ff0000;">Red text</p>
<p style="color: rgb(255, 0, 0);">Red text</p>
Notes:## The
attribute applies to all HTML elements, including text, titles, and links.
function.
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!