Skip to content

Instantly share code, notes, and snippets.

@marshallmurphy
Created May 3, 2020 22:36
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 marshallmurphy/9674199c5b7631b15e86a52695c34d6c to your computer and use it in GitHub Desktop.
Save marshallmurphy/9674199c5b7631b15e86a52695c34d6c to your computer and use it in GitHub Desktop.
.toggleRow {
display: flex;
align-items: center;
justify-content: space-between;
margin: 20px 0;
font-size: 18px;
}
.toggle {
position: relative;
display: inline-block;
width: 48px;
height: 24px;
margin: 0;
}
.toggleInput {
opacity: 0;
width: 0;
height: 0;
}
.toggleSlider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #4b5cd2;
-webkit-transition: .4s;
transition: .4s;
border-radius: 50px;
}
.toggleSlider::before {
position: absolute;
content: "";
height: 18px;
width: 18px;
left: 3px;
bottom: 3px;
background-color: #fff;
border-radius: 50%;
}
.toggle input:checked + .toggleSlider {
background-color: #4bd4bb;
}
.toggle input:checked + .toggleSlider:before {
-webkit-transform: translateX(24px);
-ms-transform: translateX(24px);
transform: translateX(24px);
}
.toggleSlider:before {
transition-timing-function: ease-in;
-webkit-transition: .4s;
transition: .4s;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment