【发布时间】:2018-05-29 11:23:37
【问题描述】:
我做了这样的设计
如何用css遮盖背景?
我试过这样的代码
.img-poster {
display: block;
max-width: 100%;
-webkit-mask-image: url(https://cdn.pbrd.co/images/GYiCod1.png), url(https://cdn.pbrd.co/images/GYiCQsM.png);
-webkit-mask-position: bottom center, center center;
-webkit-mask-repeat: no-repeat, no-repeat;
}
.add {
-webkit-mask-composite: add;
}
<section class="section poster-container">
<img src="https://imagejournal.org/wp-content/uploads/bb-plugin/cache/23466317216_b99485ba14_o-panorama.jpg" alt="" class="img-poster add img-responsive">
</section>
我使用的蒙版图片是
https://i.stack.imgur.com/fg2k5.png
https://i.stack.imgur.com/zmylJ.png
你们能告诉我我的代码有什么问题吗? 我知道我可以只导入到 png,但我尝试使用 css
【问题讨论】:
-
你可以自然地使用多个背景图片,不要使用前缀,看看这里的第一个例子:developer.mozilla.org/en-US/docs/Web/CSS/…