Skip to content

Instantly share code, notes, and snippets.

@bergonom
Created January 24, 2013 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bergonom/4627560 to your computer and use it in GitHub Desktop.
Save bergonom/4627560 to your computer and use it in GitHub Desktop.
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