回答編集履歴

1

修正案追記

2023/10/04 01:36

投稿

hatena19
hatena19

スコア34362

test CHANGED
@@ -8,3 +8,41 @@
8
8
  background-color: #241717;
9
9
  }
10
10
  ```
11
+
12
+ 修正案
13
+ ---
14
+ `!important`は副作用が大きいのでやめて、animation-fill-mode の forwards を backwards に変更するのがいいでしょう。
15
+
16
+ ```scss
17
+ .inners {
18
+ width: 80%;
19
+ height: 30px;
20
+ color: white;
21
+ display: flex;
22
+ justify-content: center;
23
+ align-items: center;
24
+ border: solid 1px #241717;
25
+ border-radius: 5px;
26
+ //opacity: 0; 削除
27
+ cursor: pointer;
28
+ transition: 0.3s;
29
+
30
+ // ここです!!!
31
+ &:hover {
32
+ transform: translateX(50px);
33
+ background-color: #241717;
34
+ }
35
+ }
36
+
37
+ //中略
38
+
39
+ .top {
40
+ background-color: blue;
41
+ animation-name: kf;
42
+ animation-duration: 0.5s;
43
+ animation-delay: 0;
44
+ animation-iteration-count: 1;
45
+ animation-fill-mode: backwards; //修正
46
+ }
47
+ ```
48
+