Toggle Switch CSS Generator
Generate CSS toggle switch styles with live preview.
17.6Kuses
8.4/10(329)
Off
On
52px
28px
22px
14px
CSS Code
.toggle {
position: relative;
display: inline-block;
width: 52px;
height: 28px;
}
.toggle input {
opacity: 0;
width: 0;
height: 0;
}
.toggle-slider {
position: absolute;
inset: 0;
background: #333355;
border-radius: 14px;
cursor: pointer;
transition: background 0.3s;
}
.toggle-slider::before {
content: "";
position: absolute;
width: 22px;
height: 22px;
left: 3px;
bottom: 3px;
background: #ffffff;
border-radius: 50%;
transition: transform 0.3s;
}
.toggle input:checked + .toggle-slider {
background: #6366f1;
}
.toggle input:checked + .toggle-slider::before {
transform: translateX(24px);
}Recommended Products
Ad📖Web Design BooksShop →🎨Color Reference GuidesShop →✏️Drawing TabletsShop →🎨Design SoftwareShop →🖥️Monitor CalibratorsShop →💻Laptop StandsShop →🖱️Wireless MouseShop →🔌USB-C HubShop →👓Blue Light GlassesShop →🖥️Desk PadShop →
Affiliate Disclosure: As an Amazon Associate, ToolBird earns from qualifying purchases. Links above are affiliate links — if you buy through them, we may earn a small commission at no extra cost to you.
Disclaimer: This tool is provided as-is for informational and educational purposes only.