1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
| <style> [type="checkbox"] { position: absolute; left: 0; opacity: 0; }
[type="checkbox"]+label { position: relative; padding-left: 2.3em; font-size: 1.05em; line-height: 1.7; cursor: pointer; }
[type="checkbox"]+label:before { content: ''; position: absolute; left: 0; top: 0; width: 1.4em; height: 1.4em; border: 1px solid #aaa; background: #FFF; border-radius: .2em; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .1), 0 0 0 rgba(203, 34, 237, .2); transition: all .275s; }
[type="checkbox"]+label:after { content: '✕'; position: absolute; top: .525em; left: .18em; font-size: 1.375em; color: #CB22ED; line-height: 0; transition: all .2s; }
[type="checkbox"]:not(:checked)+label:after { opacity: 0; transform: scale(0) rotate(45deg); }
[type="checkbox"]:checked+label:after { opacity: 1; transform: scale(1) rotate(0); }
[type="checkbox"]:disabled+label:before { box-shadow: none; border-color: #bbb; background-color: #e9e9e9; }
[type="checkbox"]:disabled:checked+label:after { color: #777; }
[type="checkbox"]:disabled+label { color: #aaa; }
/* [type="checkbox"]:focus + label:before { box-shadow: inset 0 1px 3px rgba(0,0,0, .1), 0 0 0 6px rgba(203, 34, 237, .2); } */ </style>
<div class="line"> <input type="checkbox" id="test1" /> <label for="test1">Red</label> </div>
<div class="line"> <input type="checkbox" id="test2" checked="checked" /> <label for="test2">Yellow</label> </div>
<div class="line"> <input type="checkbox" id="test3" checked="checked" disabled="disabled" /> <label for="test3">Green</label> </div>
<div> <input type="checkbox" id="test4" disabled="disabled" /> <label for="test4">Brown</label> </div>
|