1
InternetExplorer 2018-08-09 10:33:15 +08:00
不要用动画,用“过渡”就好了。
|
2
rabbbit 2018-08-09 10:33:57 +08:00 1
<div></div>
<style> div {width: 200px;height: 150px;border: 1px solid black;transition: 1s;} div:hover {box-shadow: 0 0 20px 0px rgba(0,0,0,1)} </style> |
3
wxsm 2018-08-09 10:33:58 +08:00
你这种应该用 transition,而不是 animation
|
4
rabbbit 2018-08-09 10:37:10 +08:00 1
|
5
CSGO OP @rabbbit 那如果我要初始值,是不是把初始值放入上面那个样式里就行。比如: box-shadow: 0 0 0 0 rgba(0,0,0,0);
|
6
v2xiaolang 2018-08-09 10:52:02 +08:00
学了多久到这了
|
7
CSGO OP @v2xiaolang 2 天了
|
8
whitegerry 2018-08-09 10:55:46 +08:00
css3 动画选择 position、scale、rotation、opacity。
.banner { position: relative; flex: 1; height: 350px; background: rgba(0, 144, 255, 0.10); margin: 18px 10px; box-sizing: border-box; border-radius: 10px; } .banner::after { position: absolute; left: 0; top: 0; width: 100%; height: 100%; content: ''; border-radius: 10px; box-shadow: 0 8px 55px rgba(0, 0, 0, .12); opacity: 0; transition: opacity .3s; } .banner:hover::after { opacity: 1; } |
9
chenno9 2018-08-09 10:56:03 +08:00
你给 banner 写一个相反的动画,
@keyframes banner_animation1 { from { box-shadow: 0 8px 55px 0 rgba(0,0,0,0.12); } to { box-shadow: 0 0 0 0 rgba(0,0,0,0.00); } } #banner1,#banner2{ animation: banner_animation1 1s forwards; } |
10
rabbbit 2018-08-09 10:57:43 +08:00
|