How to achieve text opaque background translucent effect in css

WBOY
Release: 2021-11-26 18:45:41
Original
5015 people have browsed it

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);}".

How to achieve text opaque background translucent effect in css

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:

      Document  
背景图半透明,文字不透明
Copy after login

Output result:

How to achieve text opaque background translucent effect in css

(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!

Related labels:
css
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!