Created
September 26, 2017 07:49
-
-
Save DioVayne/83eb821400e03712a54ababbaa76e3cd to your computer and use it in GitHub Desktop.
radiobuttons styled
This file contains 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
<div class="radio"> | |
<input id="radio-1" name="radio" type="radio" checked> | |
<label for="radio-1" class="radio-label">Checked</label> | |
</div> |
This file contains 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
@attention:#f4f4f4; /*almost white*/ | |
@accent:#3197EE; | |
.radio { | |
margin: 0.5rem; | |
input[type="radio"] { | |
opacity: 0; | |
position: absolute; | |
+ .radio-label { | |
&:before { | |
content: ''; | |
background: @attention; | |
border-radius: 100%; | |
border: 1px solid darken(@attention, 25%); | |
display: inline-block; | |
width: 1.4em; | |
height: 1.4em; | |
margin-right: 1em; | |
vertical-align: top; | |
cursor: pointer; | |
text-align: center; | |
transition: all 250ms ease; | |
} | |
} | |
&:checked { | |
+ .radio-label { | |
&:before { | |
background-color: @accent; | |
box-shadow: inset 0 0 0 4px @attention; | |
} | |
} | |
} | |
&:focus { | |
+ .radio-label { | |
&:before { | |
outline: none; | |
border-color: @accent; | |
} | |
} | |
} | |
&:disabled { | |
+ .radio-label { | |
&:before { | |
box-shadow: inset 0 0 0 4px @attention; | |
border-color: darken(@attention, 25%); | |
background: darken(@attention, 25%); | |
} | |
} | |
} | |
+ .radio-label { | |
&:empty { | |
&:before { | |
margin-right: 0; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment