In this short tutorial I’d like to show how you can convert this:
To this using only CSS!
In this example I’ll use HTML & CSS and at the end of this post you’ll find the live example where I applied this method to Gravity Form.
HTML:
CSS:
.radio-toolbar input[type="radio"] {
opacity: 0;
position: fixed;
width: 0;
}
.radio-toolbar label {
display: inline-block;
background-color: #ddd;
padding: 10px 20px;
font: 16px sans-serif, Arial;
border: 2px solid #444;
border-radius: 4px;
}
.radio-toolbar label:hover {
background-color: #dfd;
}
.radio-toolbar input[type="radio"]:focus + label {
border: 2px dashed #444;
}
.radio-toolbar input[type="radio"]:checked + label {
background-color: #bfb;
border-color: #4c4;
}
End!
Example 1:
Example 2:
Here in this example, I’ve applied the same method on Gravity Form radio options: