Material CSS Switch
How do I make an material css switch?
Google Material inspired CSS checkbox switch.. What is a material css switch? How do you make a material css switch? This script and codes were developed by Travis Arnold on 12 September 2022, Monday.
Material CSS Switch - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Material CSS Switch</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ .switch { display: inline-block; width: 40px; height: 20px; padding: 4px; border-radius: 20px; background: #ccc; vertical-align: middle; position: relative; cursor: pointer; user-select: none; transition: background 350ms ease;
}
.switch:before, .switch:after { content: ""; display: block; width: 20px; height: 20px; border-radius: 50%; position: absolute; top: 50%; transition: all 350ms cubic-bezier(0, 0.95, 0.38, 0.98), background 150ms ease;
}
.switch:before { background: rgba(128, 128, 128, 0.075); transform: translate3d(0, -50%, 0) scale(0);
}
.switch:after { background: grey; transform: translate3d(0, -50%, 0);
}
.switch:active:before { transform: translate3d(0, -50%, 0) scale(3);
}
input:checked + .switch { background: #d0efa8;
}
input:checked + .switch:before { background: rgba(131, 177, 84, 0.075); transform: translate3d(100%, -50%, 0) scale(1);
}
input:checked + .switch:after { background: #83b154; transform: translate3d(100%, -50%, 0);
}
input:checked + .switch:active:before { background: rgba(131, 177, 84, 0.075); transform: translate3d(100%, -50%, 0) scale(3);
}
.center-xy { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <div class="center-xy"> <input id="switch" type="checkbox" hidden /> <label for="switch" class="switch"></label>
</div>
</body>
</html>
Material CSS Switch - Script Codes CSS Codes
.switch { display: inline-block; width: 40px; height: 20px; padding: 4px; border-radius: 20px; background: #ccc; vertical-align: middle; position: relative; cursor: pointer; user-select: none; transition: background 350ms ease;
}
.switch:before, .switch:after { content: ""; display: block; width: 20px; height: 20px; border-radius: 50%; position: absolute; top: 50%; transition: all 350ms cubic-bezier(0, 0.95, 0.38, 0.98), background 150ms ease;
}
.switch:before { background: rgba(128, 128, 128, 0.075); transform: translate3d(0, -50%, 0) scale(0);
}
.switch:after { background: grey; transform: translate3d(0, -50%, 0);
}
.switch:active:before { transform: translate3d(0, -50%, 0) scale(3);
}
input:checked + .switch { background: #d0efa8;
}
input:checked + .switch:before { background: rgba(131, 177, 84, 0.075); transform: translate3d(100%, -50%, 0) scale(1);
}
input:checked + .switch:after { background: #83b154; transform: translate3d(100%, -50%, 0);
}
input:checked + .switch:active:before { background: rgba(131, 177, 84, 0.075); transform: translate3d(100%, -50%, 0) scale(3);
}
.center-xy { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
}
Developer | Travis Arnold |
Username | souporserious |
Uploaded | September 12, 2022 |
Rating | 3.5 |
Size | 2,979 Kb |
Views | 32,384 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Raidial Loader | 2,565 Kb |
Slide to Unlock | 3,908 Kb |
Simplistic WYSIWYG Editor | 3,740 Kb |
Hamburglar | 3,457 Kb |
Credit Card CSS3 Animation | 5,511 Kb |
Segmented Control | 3,497 Kb |
React Media Player Demo | 3,798 Kb |
React Checkbox MultiSelect | 6,915 Kb |
Parallax Mouse Move | 2,565 Kb |
Playing with CSS folding | 3,155 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
CSS3 Animated buttons | Cguillou | 3,737 Kb |
Social.svg.min | Larsenwork | 13,849 Kb |
Scroll Arrow | Robooneus | 4,437 Kb |
AngularJS Skills | Supro | 3,312 Kb |
Simple, flat contact form | Zeaklous | 2,719 Kb |
The Walking Raymarcher | Xorxor_hu | 7,934 Kb |
Reviews and Ratings Star | Zbnmstry | 1,591 Kb |
Flat iOS 7 Safari Icon | Rss | 3,332 Kb |
Base64 SVG Me | MrBambule | 44,786 Kb |
Arrow Navigation | Hinducows | 1,973 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!