">. Where represents the target element and can be a predefined color name, hexadecimal code or RGB code."/> ">. Where represents the target element and can be a predefined color name, hexadecimal code or RGB code.">

Home  >  Article  >  Web Front-end  >  How to set color of html font

How to set color of html font

下次还敢
下次还敢Original
2024-04-11 08:28:31681browse

To set the font color in HTML, you can use the color attribute of CSS, and the syntax is . Where represents the target element and can be a predefined color name, hexadecimal code, or RGB code.

How to set color of html font

How to set HTML font color

Setting font color in HTML is very simple, you just use CSS color attributes.

Syntax:

Where:

  • is the HTML element you want to set the color , such as

    ,

    , or .

  • is a predefined color name defined by CSS, such as "red", "blue", or "black".
  • is a six-digit hexadecimal code that represents the color, such as "#FF0000" (red).
  • is an RGB code that represents the color, such as "rgb(255, 0, 0)" (red).

Example:

Use predefined color name:

这个文字是红色的。

Use hex code:

这个标题是红色的。

Use RGB code:

这个文本是红色的。

Note: The

  • color attribute can be applied to any HTML element.
  • You can also use the font-color attribute, but it is deprecated and it is recommended to use color.

The above is the detailed content of How to set color of html font. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn