Home » vue » How to display one image on another as a background? [duplicate]

How to display one image on another as a background? [duplicate]

Posted by: admin November 26, 2021 Leave a comment


I want to make one image as a background for another (it will be the same image). This is going to work only on mobile version of site. I was trying different combinations of positions and displays, but it doesn’t work and this is as far as I could get:

enter image description here

This is how my Vue code looks like:

   <div class="img-big">
        :alt="productCard.altText || productCard.text"
        :alt="productCard.altText || productCard.text"

And this is scss code:

  .img-big {
    img {
      display: block;
      margin: 0px auto;
      @media only screen and (max-width: 420px) {
        z-index: 2;
        width: 70%;
        top: 0;
    .blur-background-img {
      z-index: 1;
      filter: blur(8px);
      margin: 0;
      width: 100%;

The only thing that I know works correctly is z-index, but I need to put one image (not blurred) on another (blurred, as a background)


Use position: relative for blurred image and position: absolute for another one so that it can be positioned relative to blurred one .

#outerCircle {
  position: relative;
  width: 42vw;
  height: 42vw;
  margin: auto;
  border-radius: 50%;
  border: 4px solid rgb(255, 62, 62);
  background-color: rgb(253, 133, 133);
  user-select: none;

#styleCircle {
  position: absolute;
  width: 16vw;
  height: 16vw;
  text-align: center;
  padding: 0%;
  top: 10%;
  /*Used to reposition*/
  left: 10%;
  /*Used to reposition*/
  border-radius: 50%;
  border: 3px solid black;
  background-color: rgb(255, 233, 35);
<div id="outerCircle">
  <div id="styleCircle"></div>