JSFiddle - React, Tailwind, and code Playground
HTML
<p>
This free tutorial is brought to you by <a href="https://psdtowp.net">PSDtoWP.net</a>.
<br><br>
View this tutorial online: <a href="https://psdtowp.net/resources/wordpress-content/customize-radio-buttons-checkboxes-css-sprites.html">Customize radio buttons and checkboxes with CSS sprites</a>.
<br><br>
Make sure you also check out our tutorial about <a href="https://psdtowp.net/resources/wordpress-content/customize-radio-buttons-checkboxes-css.html">Customize radio buttons and checkboxes with only CSS</a>.
</p>
<form action="" method="">
<h2>Radio Buttons → Default</h2>
<input type="radio" id="radio-default-1" name="radio-default" class="default">
<label for="radio-default-1">Radio Button 1</label>
<input type="radio" id="radio-default-2" name="radio-default" class="default">
<label for="radio-default-2">Radio Button 2</label>
<input type="radio" id="radio-default-3" name="radio-default" class="default">
<label for="radio-default-3">Radio Button 3</label>
</form>
<form action="" method="">
<h2>Custom Radio Buttons → sprite background image</h2>
<input type="radio" id="radio-img-1" name="radio-btns-sprite">
<label for="radio-img-1" class="male">Male</label>
<input type="radio" id="radio-img-2" name="radio-btns-sprite">
<label for="radio-img-2" class="female">Female</label>
</form>
<form action="" method="">
<h2>Checkbox → Default</h2>
<input type="checkbox" id="checkbox-default-1" name="checkbox-default" class="default">
<label for="checkbox-default-1">Checkbox 1</label>
<input type="checkbox" id="checkbox-default-2" name="checkbox-default" class="default">
<label for="checkbox-default-2">Checkbox 2</label>
<input type="checkbox" id="checkbox-default-3" name="checkbox-default" class="default">
<label for="checkbox-default-3">Checkbox 3</label>
</form>
<form action="" method="">
<h2>Custom Checkboxes → sprite background image</h2>
<label for="check-1" class="check"><span>1</span></label>
<input...
CSS
/******************/
/* Default styles */
/******************/
*{margin: 0;padding: 0;border: 0;font-size: 100%;font: inherit;vertical-align: baseline;}
body{background: #f5f5f5;}
form{border-top: 1px solid #bdbdbd;padding: 25px;}
form h2{margin: 0 0 20px 15px; font-weight: bold;font-size: 20px;font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;}
p{text-align: center;}
p:first-child{margin:25px 0;}
p:last-child{margin: 50px 0 0 0;}
input[type=radio].default, input[type=checkbox].default{display:inline-block!important;margin-left: 15px;}
/*****************************************/
/* Radio buttons sprite background image */
/*****************************************/
input[type=radio]{display:none;}
input[type=radio] + label.male{
display:inline-block;
cursor: pointer;
outline: 0;
width: 128px;
height: 128px;
background-image: url(https://psdtowp.net/images/resources/male.png);
background-repeat: no-repeat;
background-position: 0 0;
text-indent: -99999px;
}
input[type=radio]:checked + label.male{background-position: 0 -128px;}
input[type=radio] + label.female{
display:inline-block;
cursor: pointer;
outline: 0;
width: 128px;
height: 128px;
background-image: url(https://psdtowp.net/images/resources/female.png);
background-repeat: no-repeat;
background-position: 0 0;
text-indent: -99999px;
}
input[type=radio]:checked + label.female{background-position: 0 bottom;}
/**************************************/
/* Checkboxes sprite background image */
/**************************************/
input[type=checkbox]{display:none;}
input[type=checkbox] + label.check{
display:inline-block;
cursor: pointer;
outline: 0;
width: 40px;
height: 40px;
background-image: url(https://psdtowp.net/images/resources/checkbox.png);
background-repeat: no-repeat;
background-position: 0 0;
margin-right: 25px;
text-align: center;
font-weight:...