Skip to content

Instantly share code, notes, and snippets.

@mankutila
Created December 12, 2017 12:46
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 mankutila/b64646082a16118f9e4bfb0a7bc961b9 to your computer and use it in GitHub Desktop.
Save mankutila/b64646082a16118f9e4bfb0a7bc961b9 to your computer and use it in GitHub Desktop.
Custom checkbox / radio button
.checkbox-wrapper
input(type="checkbox", id="checkboxId", name="checkboxName")
label(for="checkboxId") м. Семеновская
span
@mixin customCheckReset() {
display:none;
& + label span {
display:inline-block;
vertical-align:middle;
cursor: pointer;
}
}
@mixin size($width, $height: $width) {
width: $width;
height: $height;
}
.checkbox-wrapper input[type="checkbox"] {
@include customCheckReset();
& + label {
width: 50%;
position: relative;
}
& + label span {
position: absolute;
@include size(rem(35));
margin: 0;
border: 2px solid #666;
background-color: #fff;
border-radius: 2px;
right: rem(-35);
top:-2px;
}
&:checked + label span {
&:before {
content: '';
display: block;
position: absolute;
@include size(rem(25));
background: url(../images/check.svg) no-repeat;
background-size: contain;
bottom: 3px;
left: rem(7);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment