<form class="form-with-custom-checkboxes-radios">
<div>
<h4>Age</h4>
<span class="wpcf7-form-control-wrap age">
<span class="wpcf7-form-control wpcf7-radio">
<span class="wpcf7-list-item first">
<label>
<input type="radio" name="age" value="" checked="checked">
<span class="wpcf7-list-item-label">Under 18</span>
</label>
</span>
<span class="wpcf7-list-item">
<label>
<input type="radio" name="age" value="">
<span class="wpcf7-list-item-label">18-30</span>
</label>
</span>
<span class="wpcf7-list-item">
<label>
<input type="radio" name="age" value="">
<span class="wpcf7-list-item-label">30-45</span>
</label>
</span>
<span class="wpcf7-list-item">
<label>
<input type="radio" name="age" value="">
<span class="wpcf7-list-item-label">45-65</span>
</label>
</span>
<span class="wpcf7-list-item last">
<label>
<input type="radio" name="age" value="">
<span class="wpcf7-list-item-label">65+</span>
</label>
</span>
</span>
</span>
</div>
<div>
<h4>Hobbies</h4>
<span class="wpcf7-form-control-wrap hobbies">
<span class="wpcf7-form-control wpcf7-checkbox">
<span class="wpcf7-list-item first">
<label>
<input type="checkbox" name="hobbies[]" value="">
<span class="wpcf7-list-item-label">Reading</span>
</label>
</span>
<span class="wpcf7-list-item">
<label>
<input type="checkbox" name="hobbies[]" value="">
<span class="wpcf7-list-item-label">Fishing</span>
</label>
</span>
<span class="wpcf7-list-item">
<label>
<input type="checkbox" name="hobbies[]" value="">
<span class="wpcf7-list-item-label">Traveling</span>
</label>
</span>
<span class="wpcf7-list-item">
<label>
<input type="checkbox" name="hobbies[]" value="">
<span class="wpcf7-list-item-label">Music</span>
</label>
</span>
<span class="wpcf7-list-item last">
<label>
<input type="checkbox" name="hobbies[]" value="">
<span class="wpcf7-list-item-label">Watching Sports</span>
</label>
</span>
</span>
</span>
</div>
</form>
<footer class="page-footer">
<span>made by </span>
<a href="https://georgemartsoukos.com/" target="_blank">
<img width="24" height="24" src="https://assets.codepen.io/162656/george-martsoukos-small-logo.svg" alt="George Martsoukos logo">
</a>
</footer>
body {
font-family: "Inter", sans-serif;
display: flex;
justify-content: center;
margin-top: 30px;
background: #e5f0e7;
}
.form-with-custom-checkboxes-radios div:first-child {
padding-bottom: 20px;
border-bottom: 1px solid;
}
.form-with-custom-checkboxes-radios h4 {
margin: 20px 0;
}
.form-with-custom-checkboxes-radios .wpcf7-list-item,
.form-with-custom-checkboxes-radios label {
display: flex;
}
.form-with-custom-checkboxes-radios .wpcf7-list-item {
margin: 0;
}
.form-with-custom-checkboxes-radios .wpcf7-list-item:not(:last-child) {
margin-bottom: 10px;
}
.form-with-custom-checkboxes-radios label {
cursor: pointer;
}
.form-with-custom-checkboxes-radios [type="radio"],
.form-with-custom-checkboxes-radios [type="checkbox"] {
position: absolute;
left: -9999px;
}
.form-with-custom-checkboxes-radios [type="radio"] + .wpcf7-list-item-label,
.form-with-custom-checkboxes-radios [type="checkbox"] + .wpcf7-list-item-label {
position: relative;
padding-left: 30px;
line-height: 20px;
}
.form-with-custom-checkboxes-radios [type="radio"] + .wpcf7-list-item-label::before,
.form-with-custom-checkboxes-radios [type="checkbox"] + .wpcf7-list-item-label::before,
.form-with-custom-checkboxes-radios [type="radio"] + .wpcf7-list-item-label::after,
.form-with-custom-checkboxes-radios [type="checkbox"] + .wpcf7-list-item-label::after {
content: "";
position: absolute;
box-sizing: border-box;
}
.form-with-custom-checkboxes-radios [type="radio"] + .wpcf7-list-item-label::before,
.form-with-custom-checkboxes-radios [type="radio"] + .wpcf7-list-item-label::after {
border-radius: 50%;
}
.form-with-custom-checkboxes-radios [type="radio"] + .wpcf7-list-item-label::before,
.form-with-custom-checkboxes-radios [type="checkbox"] + .wpcf7-list-item-label::before {
top: 0;
left: 0;
width: 20px;
height: 20px;
border: 2px solid black;
}
.form-with-custom-checkboxes-radios [type="radio"] + .wpcf7-list-item-label::after,
.form-with-custom-checkboxes-radios [type="checkbox"] + .wpcf7-list-item-label::after {
top: 5px;
left: 5px;
width: 10px;
height: 10px;
background: black;
transition: all 0.2s;
}
.form-with-custom-checkboxes-radios [type="radio"]:not(:checked) + .wpcf7-list-item-label::after,
.form-with-custom-checkboxes-radios [type="checkbox"]:not(:checked) + .wpcf7-list-item-label::after {
opacity: 0;
transform: scale(0.01);
}
.form-with-custom-checkboxes-radios [type="radio"]:checked + .wpcf7-list-item-label::after,
.form-with-custom-checkboxes-radios [type="checkbox"]:checked + .wpcf7-list-item-label::after {
opacity: 1;
transform: scale(1);
}
.form-with-custom-checkboxes-radios [type="radio"]:focus + .wpcf7-list-item-label::before,
.form-with-custom-checkboxes-radios [type="checkbox"]:focus + .wpcf7-list-item-label::before {
box-shadow: 0 0 4px 3px red;
}
/* FOOTER STYLES
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.page-footer {
position: fixed;
right: 0;
bottom: 50px;
display: flex;
align-items: center;
padding: 5px;
z-index: 1;
}
.page-footer a {
display: flex;
margin-left: 4px;
}
This Pen doesn't use any external JavaScript resources.