checked 상태에 따라 label 꾸미기
- HTML
1
2
<input type="radio" id="yes" value="yes" checked>
<label for="yes"></label>
- CSS
1
2
3
4
5
6
7
8
9
10
#yes+label {
display: inline-block;
width: 68px;
height: 31px;
background: url("https://user-images.githubusercontent.com/98504939/154197039-22c2a53c-f13a-4124-b92a-5b888da8bea8.svg") no-repeat 0 0px / contain;
}
#yes:checked+label {
background: url("https://user-images.githubusercontent.com/98504939/154194073-0af2ed1f-d718-4b33-aa30-0c978356ff2d.svg") no-repeat 0 0px / contain;
}
결과