Home  >  Article  >  Web Front-end  >  Is rgba a new attribute in css3?

Is rgba a new attribute in css3?

WBOY
WBOYOriginal
2022-01-24 14:35:062767browse

In CSS3, rgba() is a new attribute of CSS3. This function is used to generate various colors using the superposition of red, green, blue and transparency. The syntax is "rgba(red, green, blue, alpha)”.

Is rgba a new attribute in css3?

The operating environment of this tutorial: Windows 10 system, CSS3&&HTML5 version, Dell G3 computer.

Is rgba a new attribute in css3?

rgba is a new attribute in css3.

The rgba() function uses the superposition of red (R), green (G), blue (B), and transparency (A) to generate a variety of colors.

RGBA means red, green, blue, transparency (English: Red, Green, Blue, Alpha).

  • Red (R) An integer between 0 and 255, representing the red component of the color. .

  • Green (G) An integer between 0 and 255, representing the green component of the color.

  • Blue (B) An integer between 0 and 255, representing the blue component of the color.

  • Transparency (A) has a value between 0 and 1, representing transparency.

Supported version: CSS3

The syntax is:

rgba(red, green, blue, alpha)

The example is as follows:

<html>
<head>
<meta charset="utf-8">
<title>123</title>
<style>
#p1 {background-color:rgba(255,0,0,0.3);}
#p2 {background-color:rgba(0,255,0,0.3);}
#p3 {background-color:rgba(0,0,255,0.3);}
#p4 {background-color:rgba(192,192,192,0.3);}
#p5 {background-color:rgba(255,255,0,0.3);}
#p6 {background-color:rgba(255,0,255,0.3);}
</style>
</head>
<body>
<p>RGB 颜色,并使用透明度:</p>
<p id="p1">红色</p>
<p id="p2">绿色</p>
<p id="p3">蓝色</p>
<p id="p4">灰色</p>
<p id="p5">黄色</p>
<p id="p6">樱桃色</p>
</body>
</html>

Output result :

Is rgba a new attribute in css3?

(Learning video sharing: css video tutorial)

The above is the detailed content of Is rgba a new attribute in css3?. 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
Previous article:What does css3 mean?Next article:What does css3 mean?