Skip to content

Instantly share code, notes, and snippets.

@alireza-saberi
Created October 23, 2017 19:07
Show Gist options
  • Save alireza-saberi/0608f962c68a99e1a24f5067778cce13 to your computer and use it in GitHub Desktop.
Save alireza-saberi/0608f962c68a99e1a24f5067778cce13 to your computer and use it in GitHub Desktop.
replacing checkbox + radiobox
input[type="radio"] {
visibility: hidden;
position: relative;
}
input[type="radio"]:after{
visibility: visible;
position: absolute;
content: "";
top: 0;
left: 0;
background: url($sprite-sheet-path) 0 100% no-repeat;
width: 20px;
height: 20px;
cursor:pointer;
}
input[type="radio"]:checked:after{
visibility: visible;
position: absolute;
content: "";
top: 0;
left: 0;
background: url($sprite-sheet-path) 0 98.59254046446165% no-repeat;
}
input[type="checkbox"] {
visibility: hidden;
position: relative;
}
input[type="checkbox"]:after {
visibility: visible;
position: absolute;
content: "";
top: 0;
left: 0;
background: url($sprite-sheet-path) 0 41.16819141449683% no-repeat;
width: 20px;
height: 20px;
cursor:pointer;
}
input[type="checkbox"]:checked:after {
visibility: visible;
position: absolute;
content: "";
top: 0;
left: 0;
background: url($sprite-sheet-path) 0 39.76073187895848% no-repeat;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment