📜  HTML 字体颜色

📅  最后修改于: 2020-11-02 03:36:16             🧑  作者: Mango

HTML字体颜色

颜色是标签的属性,用于指定文本颜色。

句法

 

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

  • Color_name:此值通过颜色名称设置文本的颜色。

例:


  • Rgb_number:此值通过RGB代码设置文本的颜色。

例:

  • Hex_number:此值通过十六进制代码设置文本的颜色。

示例:以下示例使用不同的color属性值:

示例1:以下示例使用颜色的名称:

  
   
  
  
 Example of color attribute 
  
  
 
 
 

javaTpoint

输出:

示例2:以下示例使用十六进制代码定义文本颜色:

  
   
  
  
 Example of color attribute 
  
  
 
 
 

javaTpoint

输出:

示例3:以下示例使用rgb数字定义文本颜色:

  
   
  
  
 Example of color attribute 
  
  
 
 
 

javaTpoint

输出:

示例4:下面的示例使用字体颜色的所有属性值。

  
   
  
  
 Example of color attribute 
  
  
 

The color attribute of font tag sets the color 'maroon' for the following paragraph by using the RGB Number "rgb(0,1,0)"

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.

The color attribute of font tag sets the color 'orange' for the following paragraph by using the name of colour

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.

The color attribute of font tag sets the color 'magenta' for the following paragraph by busing the Hex code "#ff00ff"

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.

输出:

浏览器支持

Element chrome browser Chrome ie browser IE firefox browser Firefox opera browser Opera safari browser Safari
Yes Yes Yes Yes Yes