446 views
CSSAdd prefixes
1.lock-checkbox { 2 position: relative; 3 display: inline-block; 4 width: 40px; 5 height: 40px; 6 margin-right: 10px; 7} 8 9.lock-checkbox input[type="checkbox"] { 10 opacity: 0; 11 width: 0; 12 height: 0; 13} 14 15.lock-icon { 16 fill: #00ff40; 17 position: absolute; 18 top: 50%; 19 left: 50%; 20 transform: translate(-50%, -50%); 21 width: 34px; 22 height: 34px; 23 transition: all 0.3s; 24 cursor: pointer; 25} 26 27.lock-checkbox input[type="checkbox"]:checked + .lock-icon { 28 fill: #ff0000; 29} 30
HTML
1<label class="lock-checkbox"> 2 <input id="lock" type="checkbox"> 3 <span class="lock-icon"> 4 <svg viewBox="0 0 24 24"> 5 <path d="M12 17c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm6-9h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zM8.9 6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1v2H8.9V6z"></path> 6 </svg> 7 </span> 8</label> 9