Ste*_*ova 0 css arrows css-animations
我想制作以下动画:
一个带有2个相同箭头且悬停在第一个箭头上的div应该向左/向右移动.我试着这样做,但没有成功.我正在设置2个图像的背景,但我如何设置像gif这样的图像的动画?
.arrow-right2 {
content: "";
background: transparent url(https://i.imgur.com/u7cYXIo.png) 0 -185px no-repeat, transparent url(https://i.imgur.com/u7cYXIo.png) 0 -185px no-repeat;
height: 35px;
position: absolute;
top: -5%;
left: 0;
width: 35px;
}
Run Code Online (Sandbox Code Playgroud)
尝试使用具有相同箭头的2个不同div,位置绝对并使用此与两个箭头重叠.如果可以,请使用单个图像,而不是精灵.然后将效果应用于悬停在其中一个图像上.
body {
background: red;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
display: flex;
justify-content: center;
align-items: center;
width: 50px;
height: 50px;
position: relative;
}
.arrow1 {
background: url('https://i.imgur.com/u7cYXIo.png') no-repeat -17px -199px;
width: 12px;
height: 24px;
display: block;
left: 0;
position: absolute;
}
.arrow2 {
background: url('https://i.imgur.com/u7cYXIo.png') no-repeat -17px -199px;
width: 12px;
height: 24px;
display: block;
position: absolute;
transition: all 0.4s;
left: 0;
}
.arrow2:hover {
left: -10px;
transition: all 0.4s;
}Run Code Online (Sandbox Code Playgroud)
<div class="container">
<div class="arrow1">
</div>
<div class="arrow2">
</div>
</div>Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
122 次 |
| 最近记录: |