質問編集履歴

2

改善

2021/01/15 13:03

投稿

zawa0
zawa0

スコア1

test CHANGED
File without changes
test CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
 
16
16
 
17
- ### 該当ソースコード
17
+ ### 現在のコード
18
18
 
19
19
 
20
20
 
@@ -70,7 +70,7 @@
70
70
 
71
71
  }
72
72
 
73
- label:after {
73
+ #toggle1 + label:after {
74
74
 
75
75
  background-image:url('https://pics.prcm.jp/63a6a9d594d2a/77587568/png/77587568_480x480.png');
76
76
 
@@ -100,9 +100,7 @@
100
100
 
101
101
  }
102
102
 
103
- .a:checked + label:after {
103
+ #toggle2 + label:after {
104
-
105
- content: "";
106
104
 
107
105
  background-image:url('https://pics.prcm.jp/63a6a9d594d2a/77587568/png/77587568_480x480.png');
108
106
 
@@ -112,10 +110,62 @@
112
110
 
113
111
  background-size:80% 80%;
114
112
 
113
+ content: "";
114
+
115
+ position: absolute;
116
+
117
+ width: 30%;
118
+
119
+ height: 100%;
120
+
121
+ border-radius: 50%;
122
+
123
+ left: 0;
124
+
125
+ top: 0;
126
+
127
+ z-index: 2;
128
+
129
+ transition: .1s;
130
+
131
+ }
132
+
133
+
134
+
135
+ #toggle1 +.a:checked + label:after {
136
+
137
+ content: "";
138
+
139
+ background-image:url('https://cdn0.iconfinder.com/data/icons/small-n-flat/24/678087-heart-512.png');
140
+
141
+ background-repeat:no-repeat;
142
+
143
+ background-position:100%;
144
+
145
+ background-size:80% 80%;
146
+
115
147
  left: 75%;
116
148
 
117
149
  }
118
150
 
151
+
152
+
153
+ #toggle2 +.a:checked + label:after {
154
+
155
+ content: "";
156
+
157
+ background-image:url('https://cdn0.iconfinder.com/data/icons/small-n-flat/24/678087-heart-512.png');
158
+
159
+ background-repeat:no-repeat;
160
+
161
+ background-position:100%;
162
+
163
+ background-size:80% 80%;
164
+
165
+ left: 75%;
166
+
167
+ }
168
+
119
169
  .toggle-switch {
120
170
 
121
171
  position: relative;
@@ -134,9 +184,9 @@
134
184
 
135
185
  <div class="toggle-switch">
136
186
 
137
- <input id="toggle" class="a" type="checkbox">
187
+ <input id="toggle1" class="a" type="checkbox">
138
-
188
+
139
- <label for="toggle"></label>
189
+ <label for="toggle1"></label>
140
190
 
141
191
  </div>
142
192
 
@@ -144,236 +194,10 @@
144
194
 
145
195
  <div class="toggle-switch">
146
196
 
147
- <input id="toggle" class="a" type="checkbox">
197
+ <input id="toggle2" class="a" type="checkbox">
148
-
198
+
149
- <label for="toggle"></label>
199
+ <label for="toggle2"></label>
150
200
 
151
201
  </div>
152
202
 
153
203
  ```
154
-
155
-
156
-
157
- 助言いただき、こうしましたが、うまくできません
158
-
159
-
160
-
161
- ```ここに言語を入力
162
-
163
- <style>
164
-
165
- body,html{
166
-
167
- background-color:black;
168
-
169
- height:100%;
170
-
171
- }
172
-
173
- .a {
174
-
175
- position: absolute;
176
-
177
- left: 0;
178
-
179
- top: 0%;
180
-
181
- width: 100%;
182
-
183
- height: 100%;
184
-
185
- z-index: 5;
186
-
187
- opacity: 0;
188
-
189
- cursor: pointer;
190
-
191
- }
192
-
193
- .label1 {
194
-
195
- background-color:red;
196
-
197
- width: 90%;
198
-
199
- height: 75%;
200
-
201
- position: relative;
202
-
203
- display: inline-block;
204
-
205
- border-radius: 5px;
206
-
207
- transition: 0.2s;
208
-
209
- box-sizing: border-box;
210
-
211
- }
212
-
213
-
214
-
215
- .label2 {
216
-
217
- background-color:red;
218
-
219
- width: 90%;
220
-
221
- height: 75%;
222
-
223
- position: relative;
224
-
225
- display: inline-block;
226
-
227
- border-radius: 5px;
228
-
229
- transition: 0.2s;
230
-
231
- box-sizing: border-box;
232
-
233
- }
234
-
235
-
236
-
237
-
238
-
239
- label1:after {
240
-
241
- background-image:url('https://pics.prcm.jp/63a6a9d594d2a/77587568/png/77587568_480x480.png');
242
-
243
- background-repeat:no-repeat;
244
-
245
- background-position:100%;
246
-
247
- background-size:80% 80%;
248
-
249
- content: "";
250
-
251
- position: absolute;
252
-
253
- width: 30%;
254
-
255
- height: 100%;
256
-
257
- border-radius: 50%;
258
-
259
- left: 0;
260
-
261
- top: 0;
262
-
263
- z-index: 2;
264
-
265
- transition: .1s;
266
-
267
- }
268
-
269
- .a:checked + label1:after {
270
-
271
- content: "";
272
-
273
- background-image:url('https://pics.prcm.jp/63a6a9d594d2a/77587568/png/77587568_480x480.png');
274
-
275
- background-repeat:no-repeat;
276
-
277
- background-position:100%;
278
-
279
- background-size:80% 80%;
280
-
281
- left: 75%;
282
-
283
- }
284
-
285
-
286
-
287
-
288
-
289
-
290
-
291
- label2:after {
292
-
293
- background-image:url('https://cdn0.iconfinder.com/data/icons/small-n-flat/24/678087-heart-512.png');
294
-
295
- background-repeat:no-repeat;
296
-
297
- background-position:100%;
298
-
299
- background-size:80% 80%;
300
-
301
- content: "";
302
-
303
- position: absolute;
304
-
305
- width: 30%;
306
-
307
- height: 100%;
308
-
309
- border-radius: 50%;
310
-
311
- left: 0;
312
-
313
- top: 0;
314
-
315
- z-index: 2;
316
-
317
- transition: .1s;
318
-
319
- }
320
-
321
- .a:checked + label2:after {
322
-
323
- content: "";
324
-
325
- background-image:url('https://cdn0.iconfinder.com/data/icons/small-n-flat/24/678087-heart-512.png');
326
-
327
- background-repeat:no-repeat;
328
-
329
- background-position:100%;
330
-
331
- background-size:80% 80%;
332
-
333
- left: 75%;
334
-
335
- }
336
-
337
-
338
-
339
-
340
-
341
-
342
-
343
-
344
-
345
- .toggle-switch {
346
-
347
- position: relative;
348
-
349
- width: 80%;
350
-
351
- height: 20%;
352
-
353
- }
354
-
355
-
356
-
357
- </style>
358
-
359
-
360
-
361
- <div class="toggle-switch">
362
-
363
- <input id="toggle" class="a" type="checkbox">
364
-
365
- <label for="toggle" class="label1"></label>
366
-
367
- </div>
368
-
369
-
370
-
371
- <div class="toggle-switch">
372
-
373
- <input id="toggle" class="a" type="checkbox">
374
-
375
- <label for="toggle" class="label2"></label>
376
-
377
- </div>
378
-
379
- ```

1

追記

2021/01/15 13:03

投稿

zawa0
zawa0

スコア1

test CHANGED
File without changes
test CHANGED
@@ -151,3 +151,229 @@
151
151
  </div>
152
152
 
153
153
  ```
154
+
155
+
156
+
157
+ 助言いただき、こうしましたが、うまくできません
158
+
159
+
160
+
161
+ ```ここに言語を入力
162
+
163
+ <style>
164
+
165
+ body,html{
166
+
167
+ background-color:black;
168
+
169
+ height:100%;
170
+
171
+ }
172
+
173
+ .a {
174
+
175
+ position: absolute;
176
+
177
+ left: 0;
178
+
179
+ top: 0%;
180
+
181
+ width: 100%;
182
+
183
+ height: 100%;
184
+
185
+ z-index: 5;
186
+
187
+ opacity: 0;
188
+
189
+ cursor: pointer;
190
+
191
+ }
192
+
193
+ .label1 {
194
+
195
+ background-color:red;
196
+
197
+ width: 90%;
198
+
199
+ height: 75%;
200
+
201
+ position: relative;
202
+
203
+ display: inline-block;
204
+
205
+ border-radius: 5px;
206
+
207
+ transition: 0.2s;
208
+
209
+ box-sizing: border-box;
210
+
211
+ }
212
+
213
+
214
+
215
+ .label2 {
216
+
217
+ background-color:red;
218
+
219
+ width: 90%;
220
+
221
+ height: 75%;
222
+
223
+ position: relative;
224
+
225
+ display: inline-block;
226
+
227
+ border-radius: 5px;
228
+
229
+ transition: 0.2s;
230
+
231
+ box-sizing: border-box;
232
+
233
+ }
234
+
235
+
236
+
237
+
238
+
239
+ label1:after {
240
+
241
+ background-image:url('https://pics.prcm.jp/63a6a9d594d2a/77587568/png/77587568_480x480.png');
242
+
243
+ background-repeat:no-repeat;
244
+
245
+ background-position:100%;
246
+
247
+ background-size:80% 80%;
248
+
249
+ content: "";
250
+
251
+ position: absolute;
252
+
253
+ width: 30%;
254
+
255
+ height: 100%;
256
+
257
+ border-radius: 50%;
258
+
259
+ left: 0;
260
+
261
+ top: 0;
262
+
263
+ z-index: 2;
264
+
265
+ transition: .1s;
266
+
267
+ }
268
+
269
+ .a:checked + label1:after {
270
+
271
+ content: "";
272
+
273
+ background-image:url('https://pics.prcm.jp/63a6a9d594d2a/77587568/png/77587568_480x480.png');
274
+
275
+ background-repeat:no-repeat;
276
+
277
+ background-position:100%;
278
+
279
+ background-size:80% 80%;
280
+
281
+ left: 75%;
282
+
283
+ }
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+ label2:after {
292
+
293
+ background-image:url('https://cdn0.iconfinder.com/data/icons/small-n-flat/24/678087-heart-512.png');
294
+
295
+ background-repeat:no-repeat;
296
+
297
+ background-position:100%;
298
+
299
+ background-size:80% 80%;
300
+
301
+ content: "";
302
+
303
+ position: absolute;
304
+
305
+ width: 30%;
306
+
307
+ height: 100%;
308
+
309
+ border-radius: 50%;
310
+
311
+ left: 0;
312
+
313
+ top: 0;
314
+
315
+ z-index: 2;
316
+
317
+ transition: .1s;
318
+
319
+ }
320
+
321
+ .a:checked + label2:after {
322
+
323
+ content: "";
324
+
325
+ background-image:url('https://cdn0.iconfinder.com/data/icons/small-n-flat/24/678087-heart-512.png');
326
+
327
+ background-repeat:no-repeat;
328
+
329
+ background-position:100%;
330
+
331
+ background-size:80% 80%;
332
+
333
+ left: 75%;
334
+
335
+ }
336
+
337
+
338
+
339
+
340
+
341
+
342
+
343
+
344
+
345
+ .toggle-switch {
346
+
347
+ position: relative;
348
+
349
+ width: 80%;
350
+
351
+ height: 20%;
352
+
353
+ }
354
+
355
+
356
+
357
+ </style>
358
+
359
+
360
+
361
+ <div class="toggle-switch">
362
+
363
+ <input id="toggle" class="a" type="checkbox">
364
+
365
+ <label for="toggle" class="label1"></label>
366
+
367
+ </div>
368
+
369
+
370
+
371
+ <div class="toggle-switch">
372
+
373
+ <input id="toggle" class="a" type="checkbox">
374
+
375
+ <label for="toggle" class="label2"></label>
376
+
377
+ </div>
378
+
379
+ ```