Skip to content

Instantly share code, notes, and snippets.

@suzck
Last active August 29, 2015 14:24
Show Gist options
  • Save suzck/5ddd5b5943ecd1192aa5 to your computer and use it in GitHub Desktop.
Save suzck/5ddd5b5943ecd1192aa5 to your computer and use it in GitHub Desktop.
How to style a custom checkbox in SCSS
<input type="checkbox" class="real-checkbox" name="checkbox" id="checkbox1" />
<label for="checkbox1"><span class="fake-checkbox"> X </span>Crushing</label>
.fake-checkbox {
font-size: 1.5em;
padding: .15em .45em;
background-color: #fff;
display: inline-block;
cursor: pointer;
}
.real-checkbox {
display:none;
+ label .fake-checkbox {
color: #fff;
}
&:checked {
+ label .fake-checkbox {
color: $secondary;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment