#212121
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: #e5e5e5; 26 border-radius: 50%; 27} 28 29/* When the checkbox is checked, add a blue background */ 30.container input:checked ~ .checkmark { 31 background-color: seagreen; 32} 33 34/* Create the checkmark/indicator (hidden when not checked) */ 35.checkmark:after { 36 content: ""; 37 position: absolute; 38 display: none; 39} 40 41/* Show the checkmark when checked */ 42.container input:checked ~ .checkmark:after { 43 display: block; 44} 45 46/* Style the checkmark/indicator */ 47.container .checkmark:after { 48 left: 0.45em; 49 top: 0.25em; 50 width: 0.25em; 51 height: 0.5em; 52 border: solid white; 53 border-width: 0 0.15em 0.15em 0; 54 transform: rotate(45deg); 55}
Comments
MIT License