JSFiddle - React, Tailwind, and code Playground
by Michaël van de Weerd
HTML
<div class="vink">
<input type="checkbox" id="c">
</div>
<p>
check is <span id="i">unchecked</span>
</p>
CSS
input[type="checkbox"] {
display: inline;
cursor: pointer;
box-shadow: inset 13px 0 green;
margin: 0;
margin-bottom: -3px;
padding: 0;
font-size: 65%;
height: 13px;
}
input[type="checkbox"]:checked {
box-shadow: inset 13px 0 yellow;
}
div.vink {
padding: 3px;
display: inline;
box-shadow: inset 0 0 0 3px white;
box-sizing: border-box;
}
div.vink:before {
display: inline-block;
width: 13px;
height: 13px;
margin-right: -16px;
margin-bottom: -3px;
content: "";
}
JavaScript
var i = document.getElementById("i");
var c = document.getElementById("c");
c.onclick = function() {
if(c.checked) {
i.innerHTML = "checked";
} else {
i.innerHTML = "unchecked";
}
}