2
I saw this and wondered if it would be possible to merge two images with CSS only.
Is there any way to control this partial transparency of one image over the other, or of an image over a background or text?
I tried with opacity
, but it did not even come close to the desired effect, as it does not have the "merging" of an image merging in the other.
body {
margin: 0;
padding: 0;
}
main {
position: relative;
}
.bg1,
.bg2 {
position: absolute;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-size: cover;
background-repeat: none;
background-position: center;
}
.bg1 {
background-image: url(https://unsplash.it/600x400/?image=881);
}
.bg2 {
background-image: url(https://unsplash.it/600x400/?image=902);
opacity: .5;
}
<main>
<div class="bg1"></div>
<div class="bg2"></div>
</main>
Welcome Tiago, I’ll give you a hint. Edit your answer and use this btn http://prntscr.com/lui4hw to create a practical example. It will be much better for the community to see and understand your answer!
– hugocsl
Thanks for the tip, the code has been changed :)
– TiagusXP