Skip to content

Instantly share code, notes, and snippets.

@petertenhoor
Last active October 6, 2019 19:19
Show Gist options
  • Select an option

  • Save petertenhoor/3a68cb1ce122afc8710c597d304758e0 to your computer and use it in GitHub Desktop.

Select an option

Save petertenhoor/3a68cb1ce122afc8710c597d304758e0 to your computer and use it in GitHub Desktop.
CSS only radio button switch
.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