回答編集履歴

2

追記

2020/09/12 03:42

投稿

hatena19
hatena19

スコア33715

test CHANGED
@@ -63,3 +63,27 @@
63
63
 
64
64
 
65
65
  [CodePenサンプル](https://codepen.io/hatena19/pen/oNxdoRb)
66
+
67
+
68
+
69
+ ---
70
+
71
+ torakunさんの回答のように display: flex; で位置決めした方かシンプルになりますね。
72
+
73
+ その場合は、画像(#top img)の margin-top で画像か中央にくるように調整すればいいですね。
74
+
75
+
76
+
77
+ ```css
78
+
79
+ #top img{
80
+
81
+ margin-top: 140px;
82
+
83
+ max-width: 100%;
84
+
85
+ height: auto;
86
+
87
+ }
88
+
89
+ ```

1

サンプルリンク追加

2020/09/12 03:42

投稿

hatena19
hatena19

スコア33715

test CHANGED
@@ -1,6 +1,6 @@
1
- hover時の transform に translate(-50%,-50%) が必要
1
+ 位置決めを position: absolute; で。
2
2
 
3
- 位置決めは position: absolute; で。
3
+ その場合、hover時の transform translate(-50%,-50%) が必要
4
4
 
5
5
 
6
6
 
@@ -59,3 +59,7 @@
59
59
  }
60
60
 
61
61
  ```
62
+
63
+
64
+
65
+ [CodePenサンプル](https://codepen.io/hatena19/pen/oNxdoRb)