回答編集履歴

3

調整

2023/09/01 09:44

投稿

yambejp
yambejp

スコア117680

test CHANGED
@@ -7,19 +7,25 @@
7
7
  position:relative;
8
8
  height:200px;
9
9
  }
10
- .wrap svg,
11
- .wrap img{
10
+ .top-decorative-image{
12
11
  position:absolute;
13
12
  }
14
13
  .top-faq-svg--top {
15
- transform: translateY(1px);
14
+ animation:trans 1s infinite;
15
+ position:absolute;
16
- }
16
+ }
17
17
  .top-faq-svg--bottom {
18
- transform: translateY(-1px);
18
+ animation:trans 2s infinite;
19
+ position:absolute;
19
- }
20
+ }
21
+ @keyframes trans{
22
+ from{transform: translateY(100px);}
23
+ 50%{transform: translateY(0px);}
24
+ to{transform: translateY(100px);}
25
+ }
20
26
  </style>
21
27
  <div class="wrap">
22
- <div class="top-faq-svg top-faq-svg--bottom">
28
+ <div class="top-faq-svg top-faq-svg--top">
23
29
  <svg width=200 height=200>
24
30
  <circle cx=150 cy=150 r=50 fill=blue />
25
31
  </svg>
@@ -39,4 +45,11 @@
39
45
  </svg>
40
46
  </div>
41
47
  </div>
48
+ <div class="wrap">
49
+ <div class="top-decorative-image">
50
+ <img src="https://placehold.jp/ff00ff/00ff00/150x150.png?text=3">
51
+ </div>
52
+ </div>
42
53
  ```
54
+ ※調整
55
+ 先に設定したものが下にくる

2

調整

2023/09/01 09:12

投稿

yambejp
yambejp

スコア117680

test CHANGED
@@ -11,17 +11,32 @@
11
11
  .wrap img{
12
12
  position:absolute;
13
13
  }
14
+ .top-faq-svg--top {
15
+ transform: translateY(1px);
16
+ }
17
+ .top-faq-svg--bottom {
18
+ transform: translateY(-1px);
19
+ }
14
20
  </style>
15
21
  <div class="wrap">
22
+ <div class="top-faq-svg top-faq-svg--bottom">
16
- <svg width=200 height=200>
23
+ <svg width=200 height=200>
17
- <circle cx=150 cy=150 r=50 fill=blue />
24
+ <circle cx=150 cy=150 r=50 fill=blue />
18
- </svg>
25
+ </svg>
26
+ </div>
27
+ <div class="top-decorative-image">
19
- <img src="https://placehold.jp/ff0000/00ffff/150x150.png?text=1">
28
+ <img src="https://placehold.jp/ff0000/00ffff/150x150.png?text=1">
29
+ </div>
30
+ </div>
20
31
  </div>
21
32
  <div class="wrap">
33
+ <div class="top-decorative-image">
22
- <img src="https://placehold.jp/ffff00/0000ff/150x150.png?text=2">
34
+ <img src="https://placehold.jp/ffff00/0000ff/150x150.png?text=2">
35
+ </div>
36
+ <div class="top-faq-svg top-faq-svg--bottom">
23
- <svg width=200 height=200>
37
+ <svg width=200 height=200>
24
- <circle cx=150 cy=150 r=50 fill=green />
38
+ <circle cx=150 cy=150 r=50 fill=green />
25
- </svg>
39
+ </svg>
40
+ </div>
26
41
  </div>
27
42
  ```

1

調整

2023/09/01 09:05

投稿

yambejp
yambejp

スコア117680

test CHANGED
@@ -1 +1,27 @@
1
1
  imgとsvgの出現順の問題では?
2
+
3
+ # 参考
4
+ ```HTML
5
+ <style>
6
+ .wrap{
7
+ position:relative;
8
+ height:200px;
9
+ }
10
+ .wrap svg,
11
+ .wrap img{
12
+ position:absolute;
13
+ }
14
+ </style>
15
+ <div class="wrap">
16
+ <svg width=200 height=200>
17
+ <circle cx=150 cy=150 r=50 fill=blue />
18
+ </svg>
19
+ <img src="https://placehold.jp/ff0000/00ffff/150x150.png?text=1">
20
+ </div>
21
+ <div class="wrap">
22
+ <img src="https://placehold.jp/ffff00/0000ff/150x150.png?text=2">
23
+ <svg width=200 height=200>
24
+ <circle cx=150 cy=150 r=50 fill=green />
25
+ </svg>
26
+ </div>
27
+ ```