Checkbox by IndexOC
#e8e8e8
1/* Hide the default checkbox */ 2.container input { 3 position: absolute; 4 opacity: 0; 5 cursor: pointer; 6 height: 0; 7 width: 0; 8} 9 10.container { 11 display: block; 12 position: relative; 13 cursor: pointer; 14 font-size: 20px; 15 user-select: none; 16} 17 18/* Create a custom checkbox */ 19.checkmark { 20 position: relative; 21 top: 0; 22 left: 0; 23 height: 1.3em; 24 width: 1.3em; 25 background-color: #ccc; 26 border-radius: 0.25em; 27 box-shadow: 0.1em 0.1em 0.1em 0.1em rgb(41, 40, 40) inset; 28} 29 30/* When the checkbox is checked, add a blue background */ 31.container input:checked ~ .checkmark { 32 background-color: rgb(41, 40, 40); 33 border-radius: 0.25em; 34} 35 36/* Create the checkmark/indicator (hidden when not checked) */ 37.checkmark:after { 38 content: ""; 39 position: absolute; 40 display: none; 41} 42 43/* Show the checkmark when checked */ 44.container input:checked ~ .checkmark:after { 45 display: block; 46} 47 48/* Style the checkmark/indicator */ 49.container .checkmark:after { 50 left: 0.45em; 51 top: 0.25em; 52 width: 0.25em; 53 height: 0.5em; 54 border: solid white; 55 border-width: 0 0.15em 0.15em 0; 56 transform: rotate(45deg); 57} 58
161 views
161 views
MIT License