#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 border: 2px solid #414141; 26 border-radius: 5px; 27 transition: all 0.4s cubic-bezier(0.23, 1, 0.320, 1); 28} 29 30.container input:hover ~ .checkmark { 31 border: 2px solid #0974f1; 32} 33 34/* When the checkbox is checked */ 35.container input:checked ~ .checkmark { 36 box-shadow: 0 0 20px rgba(9, 117, 241, 0.8); 37 border: 2px solid #0974f1; 38} 39 40/* Create the checkmark/indicator (hidden when not checked) */ 41.checkmark:after { 42 content: ""; 43 position: absolute; 44 display: none; 45} 46 47/* Show the checkmark when checked */ 48.container input:checked ~ .checkmark:after { 49 display: block; 50} 51 52/* Style the checkmark/indicator */ 53.container .checkmark:after { 54 left: 0.45em; 55 top: 0.25em; 56 width: 0.25em; 57 height: 0.5em; 58 border: solid white; 59 border-width: 0 0.15em 0.15em 0; 60 transform: rotate(45deg); 61}
Comments
MIT License