This is how my Vue code looks like:
<div class="img-big">
<img
v-if="productCard.file"
:src="`${productCard.file}`"
:alt="productCard.altText || productCard.text"
class="blur-background-img"
>
<img
v-if="productCard.file"
:src="
`${productCard.file}`
"
:alt="productCard.altText || productCard.text"
/>
</div>
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)
CodePudding user response:
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%;
left: 10%;
border-radius: 50%;
border: 3px solid black;
background-color: rgb(255, 233, 35);
}
<div id="outerCircle">
<div id="styleCircle"></div>
</div>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" class="snippet-box-edit snippet-box-result" frameborder="0"></iframe>