Generally, we can use the opcity attribute of CSS to change the transparency of an element, but the transparency of the sub-elements under the element will also be changed, and it is useless even if the sub-elements are redefined. , for example:
Html code
The transparency of the text element will also be 0.4.
So think about it, if there is a way to only change the transparency of the background, this problem can be solved.
Method 1: Using a transparent picture as the background can achieve the effect, but is there an easier way?
Method 2: Use RGBA.
For example:
Html code