Last active
October 6, 2019 19:19
-
-
Save petertenhoor/3a68cb1ce122afc8710c597d304758e0 to your computer and use it in GitHub Desktop.
CSS only radio button switch
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
| .switch-field { | |
| overflow: hidden; | |
| input[type="radio"] { | |
| display: none; | |
| &:checked + label { | |
| background-color: $color-light-orange; | |
| border-color: $color-primary-orange; | |
| z-index: 2; | |
| cursor: auto; | |
| } | |
| } | |
| label { | |
| float: left; | |
| display: inline-block; | |
| background-color: $color-white; | |
| text-align: center; | |
| padding: 12px 50px; | |
| border: 1px solid $color-medium-gray; | |
| transition: all 0.25s ease-in-out; | |
| margin-left: -1px; | |
| z-index: 1; | |
| cursor: pointer; | |
| &:first-of-type { | |
| margin-left: 0; | |
| border-radius: $radius 0 0 $radius; | |
| } | |
| &:last-of-type { | |
| border-radius: 0 $radius $radius 0; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment