teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

chousei

2019/12/10 01:07

投稿

yambejp
yambejp

スコア117967

answer CHANGED
@@ -113,4 +113,5 @@
113
113
  </label>
114
114
  </div>
115
115
  test
116
- ```
116
+ ```
117
+ ※更新されていなかったので再更新

1

調整

2019/12/10 01:07

投稿

yambejp
yambejp

スコア117967

answer CHANGED
@@ -57,4 +57,60 @@
57
57
  </label>
58
58
  </div>
59
59
  test
60
+ ```
61
+
62
+ # 調整
63
+ ```css
64
+ <style>
65
+ div.wrap{
66
+ height:150px;
67
+ }
68
+ [type=radio]#a,[type=radio]#bc{
69
+ display:none;
70
+ }
71
+ [type=radio]#bc:not(:checked) ~ .wrap label.a,
72
+ [type=radio]#a:not(:checked) ~ .wrap label.bc{
73
+ display:none;
74
+ }
75
+ [type=radio]#a:checked ~ .wrap label.bc img.b{
76
+ animation: anime1 2s infinite;
77
+ }
78
+ [type=radio]#a:checked ~ .wrap label.bc img.c{
79
+ nimation: anime2 2s infinite;
80
+ }
81
+ label.bc img{
82
+ position:absolute;
83
+ }
84
+ @keyframes anime1{
85
+ from,50%{ z-index: 1;}
86
+ 50.1%,to{ z-index: 0; }
87
+ }
88
+ @keyframes anime2{
89
+ from,50%{ z-index: 0;}
90
+ 50.1%,to{ z-index: 1; }
91
+ }
92
+ </style>
93
+ test
94
+ <input type="radio" name="abc1" value="a" id="a" class="a">
95
+ <input type="radio" name="abc1" value="bc" id="bc" class="bc" checked>
96
+ <div class="wrap">
97
+ <label for="a" class="a">
98
+ <img src="https://placehold.jp/ff0000/00ffff/150x150.png?text=A">
99
+ </label>
100
+ <label for="bc" class="bc">
101
+ <img src="https://placehold.jp/00ff00/ff00ff/150x150.png?text=B" class="b">
102
+ <img src="https://placehold.jp/0000ff/ffff00/150x150.png?text=C" class="c">
103
+ </label>
104
+ </div>
105
+ test
106
+ <div class="wrap">
107
+ <label for="a" class="a">
108
+ <img src="https://placehold.jp/ff0000/00ffff/150x150.png?text=A">
109
+ </label>
110
+ <label for="bc" class="bc">
111
+ <img src="https://placehold.jp/00ff00/ff00ff/150x150.png?text=B" class="b">
112
+ <img src="https://placehold.jp/0000ff/ffff00/150x150.png?text=C" class="c">
113
+ </label>
114
+ </div>
115
+ test
60
116
  ```