Created
November 19, 2020 18:11
-
-
Save VihangaN/ce73ecde7ebc6d257c1e00fa0128a7e9 to your computer and use it in GitHub Desktop.
css styles for the toggle switch
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
.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