35 views
CSSAdd prefixes
1.container input { 2 position: absolute; 3 opacity: 0; 4 cursor: pointer; 5 height: 0; 6 width: 0; 7} 8 9.container { 10 display: block; 11 position: relative; 12 cursor: pointer; 13 user-select: none; 14} 15 16svg { 17 position: relative; 18 top: 0; 19 left: 0; 20 height: 50px; 21 width: 50px; 22 transition: all 0.3s; 23 fill: #666; 24} 25 26svg:hover { 27 transform: scale(1.1) rotate(-10deg); 28} 29 30.container input:checked ~ svg { 31 fill: rgb(185, 51, 51); 32} 33
HTML
1<label class="container"> 2 <input type="checkbox"> 3 <svg id="Glyph" version="1.1" viewBox="0 0 32 32" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M2.156,14.901l2.489-8.725C5.012,4.895,6.197,4,7.528,4h13.473C21.554,4,22,4.448,22,5v14 c0,0.215-0.068,0.425-0.197,0.597l-5.392,7.24C15.813,27.586,14.951,28,14.027,28c-1.669,0-3.026-1.357-3.026-3.026V20H5.999 c-1.265,0-2.427-0.579-3.188-1.589C2.047,17.399,1.809,16.12,2.156,14.901z" id="XMLID_259_"></path><path d="M25.001,20h4C29.554,20,30,19.552,30,19V5c0-0.552-0.446-1-0.999-1h-4c-0.553,0-1,0.448-1,1v14 C24.001,19.552,24.448,20,25.001,20z M27.001,6.5c0.828,0,1.5,0.672,1.5,1.5c0,0.828-0.672,1.5-1.5,1.5c-0.828,0-1.5-0.672-1.5-1.5 C25.501,7.172,26.173,6.5,27.001,6.5z" id="XMLID_260_"></path></svg> 4</label>