---
title: Font Color Attribute
localeTitle: 字体颜色属性
---
## 字体颜色属性

此属性用于为`<font>`标记中包含的文本设置颜色。

### 句法：

\`\`HTML \`\`\`

### 重要：

HTML5不支持此属性。相反，这篇[freeCodeCamp文章](https://guide.freecodecamp.org/css/colors)指定了一个可以使用的CSS方法。

### 注意：

也可以使用“十六进制代码”或“rgb代码”指定颜色，而不是使用名称。

### 例：

1.  颜色名称属性

```html

<html> 
  <body> 
   <font color="green">Font color example using color attribute</font> 
 </body> 
 </html> 
```

2.  十六进制代码属性

```html

<html> 
  <body> 
   <font color="#00FF00">Font color example using color attribute</font> 
  </body> 
 </html> 
```

3.  RGB属性

```html

<html> 
  <body> 
    <font color="rgb(0,255,0)">Font color example using color attribute</font> 
  </body> 
 </html> 

```