Categories: Uncategorized

CSS Toggle/ Switch Design Code and Tutorial

CSS Toggles

Toggle Switch Using CSS, Toggle Switches are very popular When Its comes to designing them but most of the beginners found it tough but truth is  Creating Toggles are very Easy you just need to under the concept or working of it that’s all after this you can create your own creative toggles Using CSS.

Level of Design :

Beginners and Intermediate.

       

Code : (If you wanted to Download Animated Toggle Design, Click Here)

<!DOCTYPE html>
<html>
<head>
 <title>Creating Toggle Switch</title>
<style type="text/css">
 
*{
 margin: 0px;
 padding: 0px;
}

body{
 margin: 30%;
}

label{
 width: 80px;
 height: 30px;
 position: relative;
 display: inline-block;
}

span{
 position: absolute;
 width: 80px;
 height: 30px;
 background-color: grey;
 top: 0px;
 left: 0px;
 right: 0px;
 bottom: 0px;
 border-radius: 20px;

}

span::before{
 content: "";
 position: absolute;
 width: 20px;
 height: 20px;
 background-color: white;
 border-radius: 50%;
 top: 5px;
 left: 5px;
 transition: .4s;
}

input{
 visibility: hidden;
}


input:checked + span::before{
 transform: translateX(50px);
}

input:checked + span{
 background: linear-gradient(to right, royalblue, skyblue);

}
 
</style>

</head>
<body>


 <label>
  <input type="checkbox">
  <span></span>
 </label>

<br/>
<br/>

  <label>
  <input type="checkbox">
  <span></span>
 </label>

</body>
</html>

reecry

Recent Posts

Fly DJI Avata 2 Backward Using the Motion Controller

How to Fly DJI Avata 2 Backward Using the Motion Controller! 🎮 https://youtu.be/UOZU47AxPwk In this…

2 months ago

Insta360 – Videos keep exporting backwards | Wrong side render in insta360

https://youtu.be/0RRUOIvmuWA I realized that I had my camera set up incorrectly, so when I upload…

1 year ago

Make Animated progress step bar using Figma

https://youtu.be/C3oFfV20K_c Make Animated progress step bar using Figma

1 year ago

How to Hide All Grids in Figma

https://youtu.be/o3pSH_oRzko How to Hide All Grids in Figma

1 year ago

How to Create Responsive Tool tip in figma

https://youtu.be/hdSUylKSsho How to Create Responsive Tool tip in Figma

1 year ago