3D Neon Toggle Button
Home
Snippets
3D Neon Toggle Button
HTML
CSS
JS
<input type="checkbox" id="toggle" class="toggle-input"> <label for="toggle" class="toggle-label"> <div class="toggle-ball"></div> </label>
* { margin: 0; padding: 0; box-sizing: border-box; } body { display: flex; justify-content: center; align-items: center; height: 100vh; background: #121212; } .toggle-input { display: none; } .toggle-label { width: 120px; height: 60px; background: linear-gradient(145deg, #2a2a2a, #3a3a3a); border-radius: 50px; display: flex; align-items: center; padding: 5px; position: relative; cursor: pointer; transition: 0.3s; box-shadow: inset -5px -5px 10px rgba(255, 255, 255, 0.05), inset 5px 5px 10px rgba(0, 0, 0, 0.5); } .toggle-ball { width: 50px; height: 50px; background: radial-gradient(circle at 30% 30%, #555, #222); border-radius: 50%; position: absolute; left: 5px; transition: 0.4s ease-in-out; box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.5), -3px -3px 10px rgba(255, 255, 255, 0.05); } .toggle-ball::after { content: ""; position: absolute; top: 10%; left: 20%; width: 20%; height: 20%; background: rgba(255, 255, 255, 0.3); border-radius: 50%; } .toggle-input:checked + .toggle-label .toggle-ball { left: calc(100% - 55px); box-shadow: 0px 0px 15px rgba(0, 255, 127, 0.7); }
//javascript
Ad #1
Ad #2
Scroll to Top