Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Update to CSS for creating custom checkboxes and radio buttons. This CSS will allow the input elements to show that they have focus when the user accesses tabs through form elements. See the original article here: http://www.inserthtml.com/2012/06/custom-form-radio-checkbox
/* Hide the checkbox offscreen */
.regular-checkbox {
display: inline;
left: -8000px;
position: fixed;
}
/* Highlight the custom checkbox's border when the checkbox has focus. */
.regular-checkbox:focus + label {
border: 1px solid #000;
}
/* Hide the radio button offscreen */
.regular-radio {
display: inline;
left: -8000px;
position: fixed;
}
/* Highlight the custom radio button's border when the radio button has focus. */
.regular-radio:focus + label {
border: 1px solid #000;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.