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

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…

9 months ago

Make Animated progress step bar using Figma

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

11 months ago

How to Hide All Grids in Figma

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

11 months ago

How to Create Responsive Tool tip in figma

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

11 months ago

Pixel Grid not visible in figma | How to Turn on figma Pixel Grid

https://youtu.be/AEiH7dSDhKo Having issue in figma pixel grid? learn how to show/ hide figma pixel grid…

11 months ago

Fix External Monitor Lag on Mac OS Ventura

https://youtu.be/iilYzHg9LwQ There are some issues going on in ventura OS its still in development phase…

2 years ago