Home >Web Front-end >CSS Tutorial >How to set text transparent background opaque using css
In CSS, you can use the color attribute with the rgba() function to set the text transparent background opaque effect. The syntax format is "rgba(red, green, blue, alpha)"; among them, the parameter alpha is used to set Transparency, value between "0.0" and "1.0".
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
css Set text transparent background opaque
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style type="text/css"> div{ background: palevioletred; width: 200px; height: 200px; } .box { color: rgba(255, 255, 255, 0.4) } </style> </head> <body> <div> <span>我是正常文字</span><br /> <span class="box">我是透明文字</span> </div> </body> </html>
Rendering:
css RGBA
RGBA means (Red-Green-Blue-Alpha). It is extended on RGB to include the "alpha" channel, which sets the transparency of the color value.
Syntax:
RGBA(R,G,B,A)
Value:
R: red value. Positive integer | Percent
G: Green value. Positive integer | Percent
B: Blue value. Positive integer | Percent
A: Alpha transparency, ranging from 0 to 1.
Recommended tutorial: CSS video tutorial
The above is the detailed content of How to set text transparent background opaque using css. For more information, please follow other related articles on the PHP Chinese website!