回答編集履歴

1

コード追記

2022/09/06 04:21

投稿

hatena19
hatena19

スコア33768

test CHANGED
@@ -17,3 +17,26 @@
17
17
  ```
18
18
  ![イメージ説明](https://ddjkaamml8q8x.cloudfront.net/questions/2022-09-06/7dee8adc-cb10-4e4e-8bac-59531e230981.png)
19
19
 
20
+ ---
21
+
22
+ 現状のコードはバナーアイテムを一つずつ`position: fixed;`でレイアウトしていたりとかいろいろ無駄が多いので、
23
+ `.floating-banar`をfixedで配置して、アイテムはflexで横並びさせれば、シンプルなコードで記述できます。
24
+ コード例を提示しておきますので、よろしかったらご参考に。
25
+
26
+ ```css
27
+ .floating-banar {
28
+ display: flex;
29
+ gap: 10px;
30
+ position: fixed;
31
+ right: 50px;
32
+ bottom: 5px;
33
+ }
34
+ .floating-banar > div {
35
+ width: 50px
36
+ }
37
+
38
+ img.pc {
39
+ width: 100%;
40
+ }
41
+ ```
42
+