0

Is there a way to wrap an Image with transparent image without using position:absolute and top , left ,bottom and right positions ,I have tried to add div then img with transparent image url but it shows only the second image.

for example :

<style>
  .Image{
     width:100px;
     height:100px;
     border-radius: 50%;
   }
</style>

<div class="Image" style="background-image:'url(./assets/Image.png)'">
   <img class="Image" src="url(./assets/trans-image.png)"/>
</div>

enter image description here

1
  • it shows only the second image. --> which is logical since you made both to have the same size and one above the other Commented Jan 14, 2020 at 14:33

1 Answer 1

1

Something like this? You might have to change the background position of each depending on your choice of images as mine are both the same size.

.overlay-image {
  width: 300px;
  height: 100vh;
  background-image: url(https://i.ibb.co/GvXnt0J/top-img.png), url(https://i.ibb.co/VvdwhTc/bottom-img.png);
  background-repeat: no-repeat;
  background-position: 0 0, 0 0;
  background-size: contain;
}
<div class="overlay-image"></div>

Sign up to request clarification or add additional context in comments.

1 Comment

Great Answer , thank you.the 'background-image' with multi url solve my problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.