How is the transparency of rgba and opacity different?

R: Red value. Positive integer | Percentage
G: Green value. Positive integer | Percentage
B: Blue value. Positive integer | percentage

A: Alpha transparency. The value ranges from 0 to 1. A value of 0 indicates complete transparency, and a value of 1 indicates complete opacity.

Both rgba () and opacity can achieve transparency, but the difference is

rgba () only affects the color or background color of the element itself, and has no effect on the content of the element;

opacity not only affects the color or background color of the element itself, but also the transparency of the content within the element

 

 

Published 203 original articles · praised 8 · 10,000+ views

Guess you like

Origin blog.csdn.net/z591102/article/details/105533194