0

I've been trying for hours to make these images appear on top of each other. I've tried using position and z-index but I can't make it work.Please help. CSS/HTML.

HTML.

<div class="test">
    <img class="bg" src="images/pattern-bg.svg" alt="">
    <img class="img" src="images\image-tanya.jpg" alt="tanya">
</div>

CSS
`````````````````````````````````````````````````````````````````
.bg {
  position: relative;
  height: 450px;
  width: 450px;
  margin: 0;
}

img {
  position: relative;
  float: right;
  height: 350px;
  width: 350px;
}
``````````````````````````````````````````````````````````````````
Thank You.

1 Answers1

1

Try this..

    .rect
    {
      position: relative;
      top: 0;
      left: 0;
    }
    .another-rec
    {
      position: absolute;
      top: 60px;
      left: 80px;
    }
<div style="position: relative; left: 0; top: 0;">
            <img src="https://dummyimage.com/600x400/000/fff" class="rect"/>
            <img src="https://dummyimage.com/600x400/ccc/fff" class="another-rec"/>
          </div>
key
  • 1,334
  • 1
  • 19
  • 39