#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: #343434; 26 border-radius: 5px; 27 transition: all 0.5s; 28} 29 30/* When the checkbox is checked, add a blue background */ 31.container input:checked ~ .checkmark { 32 background-color: #f0f0f0; 33 border: 2px solid #343434; 34} 35 36/* Create the checkmark/indicator (hidden when not checked) */ 37.checkmark:after { 38 content: ""; 39 position: absolute; 40 display: none; 41 filter: drop-shadow(0 0 10px #888); 42} 43 44/* Show the checkmark when checked */ 45.container input:checked ~ .checkmark:after { 46 display: block; 47} 48 49/* Style the checkmark/indicator */ 50.container .checkmark:after { 51 left: 0.3em; 52 top: 0.05em; 53 width: 0.3em; 54 height: 0.65em; 55 border: solid #343434; 56 border-width: 0 0.2em 0.2em 0; 57 border-radius: 4px; 58 transform: rotate(45deg); 59 animation: bounceFadeIn 0.5s cubic-bezier(0.165, 0.84, 0.44, 1); 60} 61 62@keyframes bounceFadeIn { 63 from { 64 transform: translate(0, -10px) rotate(45deg); 65 opacity: 0; 66 } 67 68 to { 69 transform: translate(0, 0) rotate(45deg); 70 opacity: 1; 71 } 72}
7.5K views
7.5K views
Comments
MIT License