Contents
How to change the style to radio buttons to look like check boxes…
- input[type=”radio”] {
- -webkit-appearance: checkbox;
- -moz-appearance: checkbox;
- -ms-appearance: checkbox; /* not currently supported */
- -o-appearance: checkbox; /* not currently supported */
- }
Custom Radio Button Style#
- Step 1: Hide the Native Radio Input#
- Step 2: Custom Unchecked Radio Styles#
- Step 3: Improve Input vs.
- Step 4: The :checked State#
- Step 5: The :focus State#
How do I tick a radio button?
Radio button
- The radio class is a simple wrapper around the HTML elements.
- You can check a radio button by default by adding the checked HTML attribute to the element.
- You can disable a radio button by adding the disabled HTML attribute to both the and the .
Onto the .control__indicator – this is what we will style to look like checkboxes/radio buttons. For the purpose of this tutorial, I have styled the checkboxes and radio buttons similarly – the only modification here being border-radius: 50%; to make the radio buttons circular.
The styling of the radio buttons is advanced and responsive. Radio Selects is a work in progress by Adam Clark. The interface and look of these CSS radio buttons are reminiscent of many games. So this example is useful for an app and game developer. Many corporate sites also use this style.
What’s the best way to style a checkbox?
While styling is considered to be quite complicated, using pseudo elements such as :before, :after, :active, :hover and :checked, can help to style checkboxes. If you want to style the checkbox or the radio button, you first should hide the default style. In this article we will cover three essential points:
Frequently you will need to change the default radio button style to have attractive forms. For that purpose, you first need to hide the default style of the radio button using the CSS opacity property set to zero (0). Or use the visibility property with its “hidden” value.