1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| .cbxBox { position: relative; } .cbxBox .cbx { position: relative; display: block; width: 25px; height: 25px; border: 1px solid #a1a1a1; border-radius: 5px; cursor: pointer; transition: all 0.3s ease; } .cbxBox .cbx:after { content: ''; position: absolute; top: 2px; left: 10px; width: 5px; height: 14px; opacity: 0; transform: rotate(45deg) scale(0); border-right: 2px solid #fff; border-bottom: 2px solid #fff; transition: all 0.3s ease; } .cbxBox input[type=checkbox] { display: none !important; } .cbxBox input[type=checkbox]:checked ~ .cbx { border-color: transparent; background: #392ca7; animation: anima 0.6s ease; } .cbxBox input[type=checkbox]:checked ~ .cbx:after { opacity: 1; transform: rotate(45deg) scale(1); } @keyframes anima { from { transform: scale(1, 1); } 25% { transform: scale(0.95, 0.95); } 50% { transform: scale(1.15, 1.15); } 75% { transform: scale(0.95, 0.95); } to { transform: scale(1, 1); } }
|