.checkbox-box-sizes() { top: 0; left: 0; width: 18px; height: 18px; border: 2px solid #999; transform: rotate(0deg); } .checkbox-mark-sizes() { top: -1px; left: 5px; width: 10px; height: 18px; border: 2px solid #0F9D58; border-width: 0 2px 2px 0; transform: rotate(45deg); } .checkbox-result-sizes() { top: 13px; left: 5px; width: 4px; height: 4px; transform: rotate(45deg); } .e-component { white-space: nowrap; * { display: inline-block; } select:focus { outline: 1px dotted; } span { margin-left: 0.5em; white-space: normal; } select + span { padding: 2px 0; } } .e-checkbox { cursor: pointer; margin-bottom: 6px; padding: 2px 0; input { opacity:0; position:absolute; top:0; left:0; } &:focus-within { outline: 1px dotted; } &.disabled { cursor: not-allowed; opacity: 0.5; } } .e-checkbox.material-design { line-height: 20px; padding-left: 18px; position: relative; width: auto !important; > div { position: absolute; margin-top: 1px; .checkbox-box-sizes(); animation: checkmark-to-box 200ms ease-out forwards; } input:checked + div { .checkbox-mark-sizes(); animation: box-to-checkmark 200ms ease-out forwards; } } @keyframes box-to-checkmark { 0% { .checkbox-box-sizes(); } 50% { .checkbox-result-sizes(); } 100% { .checkbox-mark-sizes(); } } @keyframes checkmark-to-box { 0% { .checkbox-mark-sizes(); } 50% { .checkbox-result-sizes(); } 100% { .checkbox-box-sizes(); } }