Skip to content

Instantly share code, notes, and snippets.

@VihangaN
Created November 19, 2020 18:11
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 VihangaN/ce73ecde7ebc6d257c1e00fa0128a7e9 to your computer and use it in GitHub Desktop.
Save VihangaN/ce73ecde7ebc6d257c1e00fa0128a7e9 to your computer and use it in GitHub Desktop.
css styles for the toggle switch
.slider{
position: relative;
width:100px;
height: 50px;
display: inline-block;
cursor: pointer;
margin:0px 10px 0px 10px;
transform: scale(0.7);
}
.sort{
width:100px;
height: 50px;
border-radius: 50px;
background-color: transparent;
border:1px solid #000;
position: absolute;
display: flex;
align-items: center;
}
.slider input{
position: absolute;
display: none;
}
.sort::before{
position: absolute;
left:10px;
height:40px;
width:40px;
background-color: rgb(0, 0, 0);
content: ' ';
border-radius: 50%;
transition: 0.4s;
cursor: pointer;
}
input:checked + .sort::before{
transform: translateX(40px);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment