Get the App
SLTechnology News&Howtos  ›  Development  › 

How to write css3 color transparency

Shulou Source: shulou.com Published: 2022-06-02 07:21:05 10月03日 Update

This article mainly shows you "css3 color transparency how to write", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "css3 color transparency how to write" this article.

Write: 1, "rgba (red, green, blue, transparency)"; rgba () function through the red, green and blue superposition to generate a variety of colors and control color transparency; 2, "hsla (hue, saturation, brightness, transparency)"; hsla () function through hue, saturation and brightness to define color and control color transparency.

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

How to write css3 color transparency

1. In css, you can use the rgba () function to generate a variety of colors using the superposition of red (R), green (G), blue (B) and transparency (A).

The syntax is as follows:

Rgba (red, green, blue, alpha)

Where:

Examples are as follows:

123#p1 {background-color:rgba;} # p2 {background-color:rgba;}

RGB color and use transparency:

Red

Red

Output result:

2. The hsla () function uses hue, saturation, brightness, and transparency to define colors.

HSLA means hue, saturation, brightness and transparency (English: Hue, Saturation, Lightness, Alpha).

Examples are as follows:

123#p1 {background-color:hsla (120100% 50% 0.30);} # p2 {background-color:hsla (120100% 50% 1st);}

HSL color and use transparency:

Green

Green

Output result:

The above is all the contents of the article "how to write css3 Color Transparency". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Transparency color brightness function hue saturation saturation content articles red green examples results Calais learning help control generation output all kinds Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Linux Xiaomi vpn Apple