Method: 1. Use the width and height attributes to set the size of the text element to be the same as the parent element; 2. Use the background attribute and rgba() function to achieve the text opaque background translucent effect, the syntax "text element {background :rgba(255,255,255,transparent value);}".
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
How to achieve text opaque background translucent effect in css
In css, you can use the position attribute and set it to absolute bit to generate text elements Absolute positioning, positioned relative to the first parent element other than static positioning. Position it absolutely relative to the image element.
Use the background attribute and rgba() function to set the transparency of the background image.
Let’s take an example to see how to set the text opaque background semi-transparent effect. The example is as follows:
Output result:
(Learning video sharing:css video tutorial)
The above is the detailed content of How to achieve text opaque background translucent effect in css. For more information, please follow other related articles on the PHP Chinese website!