【发布时间】:2022-01-04 12:33:13
【问题描述】:
当悬停在效果背景之前看不到。但在效果后台工作之后。我尝试不同的方式。我也使用 z-index,但它也不起作用。
.img-hover {
position: relative;
overflow: hidden;
}
.img-hover img {
transition: 0.4s ease-in-out;
cursor: pointer;
}
.img-hover::after {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(17, 17, 17, 0.294);
content: "";
transition: all ease-in-out 0.7s;
cursor: pointer;
}
.img-hover:hover::after {
top: 0;
left: 0;
width: 0;
height: 0;
}
.img-hover::before {
position: absolute;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
background-color: rgba(17, 17, 17, 0.294);
content: "";
transition: all ease-in-out 0.7s;
}
.img-hover:hover::before {
bottom: 0;
right: 0;
width: 0;
height: 0;
}
但代码不起作用。我试图找出答案,但是
【问题讨论】:
-
请加jsx或者html代码,会有帮助的
标签: css reactjs responsive-design