color<font> 标签的属性,用于指定文本的颜色。

语法

<font color="颜色名称|rgb数值|十六进制数值">

我们可以使用以下不同的属性值来指定文本颜色:

  • 颜色名称: 使用颜色名称来设置文本的颜色。

语法:

<font color="Blue">
  • RGB 数值: 使用 RGB 代码来设置文本的颜色。

语法:

<font color="rgb(128,128,0)">
  • 十六进制数值: 使用十六进制代码来设置文本的颜色。

语法:

<font color="#00FF00">

示例 :以下示例使用了所有属性值来设置字体颜色。

<!DOCTYPE html>
<html>
<head>
<title>Example of color attribute</title>
</head>
<body>
<center>
<h2>The color attribute of font tag sets the color 'maroon' for the following paragraph by using the RGB Number "rgb(0,1,0)"</h2>
</center>
<font color="rgb(0,1,0)">
<p>
HTML is an acronym which stands for Hyper Text Markup Language which is used for creating web pages and web applications. Let's see what is meant by Hypertext Markup Language, and Web page.
</p>
</font>
<center>
<h2>The color attribute of font tag sets the color 'orange' for the following paragraph by using the name of colour</h2>
</center>
<font color="orange">
<p>
HTML is an acronym which stands for Hyper Text Markup Language which is used for creating web pages and web applications. Let's see what is meant by Hypertext Markup Language, and Web page.
</p>
</font>
<center>
<h2>The color attribute of font tag sets the color 'magenta' for the following paragraph by busing the Hex code "#ff00ff"</h2>
</center>
<font color="#ff00ff">
<p>
HTML is an acronym which stands for Hyper Text Markup Language which is used for creating web pages and web applications. Let's see what is meant by Hypertext Markup Language, and Web page.
</p>
</font>
</body>
</html>

输出:

1.png

浏览器支持

元素chrome browser Chromeie browser IEfirefox browser Firefoxopera browser Operasafari browser Safari
<font color="">

标签: html, HTML教程, HTML技术, HTML学习, HTML学习教程, HTML下载, HTML语言, HTML开发, HTML入门教程, HTML进阶教程, HTML面试题, HTML笔试题, HTML编程思想