Skip to content

Instantly share code, notes, and snippets.

@JulienCabanes
Created February 7, 2014 12:34
Show Gist options
  • Save JulienCabanes/8861882 to your computer and use it in GitHub Desktop.
Save JulienCabanes/8861882 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class="checkbox">
<input id="my-checkbox" type="checkbox">
<label for="my-checkbox">
<span class="checked-content">Checked</span>
<span class="unchecked-content">Unchecked</span>
</label>
</div>
<div class="checkbox fake-checkbox">
<input id="my-fake-checkbox" type="checkbox">
<label for="my-fake-checkbox">
<span class="checked-content">Checked</span>
<span class="unchecked-content">Unchecked</span>
</label>
</div>
// ----
// Sass (v3.3.0.rc.2)
// Compass (v1.0.0.alpha.17)
// ----
.checked-content {
display: none;
}
input:checked + label {
.checked-content {
display: inline;
}
.unchecked-content {
display: none;
}
}
.fake-checkbox:not(:root) {
input {
position: absolute;
opacity: 0;
}
label:before {
content: 'X';
color: red;
}
input:checked + label:before {
content: 'V';
color: green;
}
}
.checked-content {
display: none;
}
input:checked + label .checked-content {
display: inline;
}
input:checked + label .unchecked-content {
display: none;
}
.fake-checkbox:not(:root) input {
position: absolute;
opacity: 0;
}
.fake-checkbox:not(:root) label:before {
content: 'X';
color: red;
}
.fake-checkbox:not(:root) input:checked + label:before {
content: 'V';
color: green;
}
<div class="checkbox">
<input id="my-checkbox" type="checkbox">
<label for="my-checkbox">
<span class="checked-content">Checked</span>
<span class="unchecked-content">Unchecked</span>
</label>
</div>
<div class="checkbox fake-checkbox">
<input id="my-fake-checkbox" type="checkbox">
<label for="my-fake-checkbox">
<span class="checked-content">Checked</span>
<span class="unchecked-content">Unchecked</span>
</label>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment