Created
December 12, 2017 12:46
-
-
Save mankutila/b64646082a16118f9e4bfb0a7bc961b9 to your computer and use it in GitHub Desktop.
Custom checkbox / radio button
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.checkbox-wrapper | |
input(type="checkbox", id="checkboxId", name="checkboxName") | |
label(for="checkboxId") м. Семеновская | |
span |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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