我在 html 中有这个 div
<div class="overlap">
<img src="images/somepicture.jpg" alt="IMG-PRODUCT">
</div>
这是我的CSS
.overlap{
position: relative;
background-color: blue;
}
.overlap:after{
content: "";
-webkit-transition: transform 0.9s ease;
-o-transition: transform 0.9s ease;
-moz-transition: transform 0.9s ease;
transition: transform 0.9s ease;
background-image: url('../images/anotherPicture.png');
background-repeat: no-repeat;
background-size: 100% 100%;
display: inline-block;
position: absolute;
width: 36%;
height: 40%;
top:23%;
left: 34%;
}
.overlap:hover:after{
-webkit-transform: scale(1.2);
-moz-transform: scale(1.2);
-ms-transform: scale(1.2);
-o-transform: scale(1.2);
transform: scale(1.2);
}
我需要在.overlap:after{图像中background-image: url(使用来自 php 变量的值进行更改,如下所示:
background-image: url('../images/$imageName.png');
慕无忌1623718
绝地无双