What you need to do is to hide the actual html element of the checkbox and create a new one that can be styled easily.
So the logic of this approach is to have a span for the box and a span for the icon and style each accordingly - showing the icon when the input is checked using the :checked pseudoselector.
Note that the label wraps around the whole group so that clicking anywhere on the label will toggle the checkbox - doing it this way removeds the need for the for attribute.
I also added a checked function that will toggle the other checkbox whebn the showAll check is checked.
Edit - note that you can use other methods of getting the icon in there- you may prefer the font awesome fa-check icon for example.
const showAll = document.querySelector("#showAll");
showAll.addEventListener('click', () => toggleAll());
function toggleAll() {
document.querySelector("#showfl").checked = showAll.checked;
}
.checkbox-wrapper {
margin-bottom: 16px;
}
input[type=checkbox]{
display: none
}
.checkbox-box{
display: inline-block;
height: 25px;
width: 25px;
background-color: #eee;
text-align: center
}
.checkbox-icon {
visibility: hidden
}
input[type=checkbox]:checked + .checkbox-box{
background-color: #3ee738;
}
input[type=checkbox]:checked + .checkbox-box .checkbox-icon {
visibility: visible
}
<div class="checkbox-wrapper">
<label>
<input type="checkbox" id="showAll" name="showAll" />
<span class="checkbox-box">
<span class="checkbox-icon">✓</span>
</span> Show All
</label>
</div>
<div class="checkbox-wrapper">
<label>
<input type="checkbox" id="showfl" name="showfl" />
<span class="checkbox-box">
<span class="checkbox-icon">✓</span>
</span> Filtered
</label>
</div>