I have a problem and I have been searching the forums for many hours and I have not been able to find the solution and that is why I need your help.
You will need an image that has to be on top of another, so you can "Hover" over it, you can see the image behind it, the images are the same size, but image # 1 is black and white the image above it is) and image # 2 is in color (it is the image that is below); I have some inconveniences to be able to do this.
The images come from the Database and are mounted in a loop, the CSS is made with Sass, the inconvenience that I have is when the was the following code:
This is the code in html:
.collabs__light
position: absolute;
left: 0;
up: 0;
index z: -1;
.collabs__color
position: absolute;
left: 0;
up: 0;
index z: -2;
@foreach ($ collabs as $ index => $ collab)
<div class = "col-3 col-sm-2">
<img src = "{{asset ('storage / assets / collabs /'. $ collab .'_ light.png ')}}" class = "img-fluid collabs__light">
<img src = "{{asset ('storage / assets / collabs /'. $ collab .'_ color.png ')}}" class = "img-fluid collabs__color">
</ div>
@endforeach
All the images are mounted on top of each other, as in the following example:
And they should look like this: I've tried using an image with position: relative and position: absolute
.collabs__light
posición: relative;
izquierda: 0;
arriba: 0;
z-index: -1;
.collabs__color
posición: absoluta;
izquierda: 0;
arriba: 0;
z-index: -1;
and this happens: Everything would be fine, but one image is bigger than the other if I apply postition: absolute
Can someone help me with this please?