.checkbox-box { display: inline-block; height: 20px; vertical-align: middle; width: 35px; } .checkbox-box input[type=checkbox] { max-height: 0; max-width: 0; opacity: 0; position: absolute; } .checkbox-box input[type=checkbox] + label { border-radius: 4px; border: 2px solid #212529; cursor: pointer; display: block; height: 20px; margin-bottom: 0; margin-top: 0; position: relative; text-indent: -5000px; width: 20px; } .checkbox-box input[type=checkbox] + label:before { border-color: #212529; border-style: solid; border-width: 0px 0px 2px 2px; content: ""; display: block; height: 5px; left: 8px; opacity: 0; position: absolute; top: 7px; transform: translate3d(-50%, -50%, 0px) rotate(-45deg); transition: .1s ease-in-out; width: 7px; } .checkbox-box input[type=checkbox]:checked + label { border-color: #212529; } .checkbox-box input[type=checkbox]:focus + label { box-shadow: 0 0 0 0.25rem rgb(13 110 253 / 25%); outline: 0; } .checkbox-box input[type=checkbox]:hover + label:before { border-color: #212529; opacity: 0.5; } .checkbox-box input[type=checkbox]:checked + label:before { border-color: #212529; opacity: 1; } /* Blue */ .checkbox-box.blue input[type=checkbox]:checked + label { border-color: #007bff; } .checkbox-box.blue input[type=checkbox]:focus + label { box-shadow: 0 0 0 0.25rem rgb(49 132 253 / 50%); } .checkbox-box.blue input[type=checkbox]:checked + label:before { border-color: #007bff; } /* Green */ .checkbox-box.green input[type=checkbox]:checked + label { border-color: #28a745; } .checkbox-box.green input[type=checkbox]:focus + label { box-shadow: 0 0 0 0.25rem rgb(60 153 110 / 50%); } .checkbox-box.green input[type=checkbox]:checked + label:before { border-color: #28a745; } /* Red */ .checkbox-box.red input[type=checkbox]:checked + label { border-color: #dc3545; } .checkbox-box.red input[type=checkbox]:focus + label { box-shadow: 0 0 0 0.25rem rgb(225 83 97 / 50%); } .checkbox-box.red input[type=checkbox]:checked + label:before { border-color: #dc3545; } /* White */ .checkbox-box.white input[type=checkbox]:checked + label { border-color: #fff; } .checkbox-box.white input[type=checkbox]:focus + label { box-shadow: 0 0 0 0.25rem rgb(211 212 213 / 50%); } .checkbox-box.white input[type=checkbox]:checked + label:before { border-color: #fff; }