Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does css3 color mask the background image?

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article "css3 how to add color mask to the background picture" most people do not understand, so the editor summarized the following content, detailed, clear steps, with a certain reference value, I hope you can get something after reading this article, let's take a look at this "css3 how to add color mask to the background picture" article.

Method 1: overlay by positioning (pay attention to the hierarchy)

.wrap1 {

Position: relative

Width: 1200px

Height: 400px

Background: rgba (0,0,0,.5)

}

.wrap1 .inner {

Position: absolute

Left: 0

Right: 0

Top: 0

Bottom: 0

Background: url (ban8.jpg) no-repeat center center

Background-size: cover

Z-index:-1

}

Method 2: superposition through pseudo-class elements

.wrap2 {

Position: relative

Width: 1200px

Height: 400px

Background: url (ban8.jpg) no-repeat center center

Background-size: cover

}

.wrap2:: before {

Content: ""

Position: absolute

Left: 0

Right: 0

Bottom: 0

Top: 0

Background-color: rgba (0,0,0,.5)

Z-index: 2

}

Method 3: CSS3 color overlay background-blend-mode:multiply; (positive overlay)

.wrap3 {

Position: relative

Width: 1200px

Height: 400px

Background: url (ban8.jpg) rgba (0,0,0,0.5) no-repeat center center

Background-blend-mode: multiply

}

Expansion: background blur plus color overlay

.wrap4 {

Position: relative

Width: 1200px

Height: 400px

Background: url (ban8.jpg) rgba (0,0,0,0.5) no-repeat center center

Background-blend-mode: multiply

Filter: blur (2px)

Overflow: hidden

}

The above is about the content of this article on "how css3 adds color masks to background pictures". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report