【发布时间】:2019-02-13 01:47:45
【问题描述】:
我想让一张图片滑动(带有关键帧),然后 :hover 让它的比例变大,当 :active 时,减小它的比例。当我这样做时,它只会滑动, :hover 和 :active 不起作用...请帮助
#slide-right {
margin-left: 25px;
margin-right: 25px;
margin-bottom: 25px;
height: 250px;
box-shadow: 0px 1px 5px grey;
border-radius: 10px;
transition: .5s;
animation: slide-right 1s ease-out both;
}
#slide-right:hover {
transition: .5s;
transform: scale(1.04);
}
#slide-right:active {
transition: .2s;
transform: scale(0.95);
}
@keyframes slide-right {
0% {
transform: translateX(0);
}
100% {
transform: translateX(+200px);
}
}
<img src="https://www.w3schools.com/w3css/img_lights.jpg" id="slide-right">
【问题讨论】:
标签: html css hover css-animations keyframe