Circular Toggle Switch - MeggiTools
Run
Toggle Theme
Share Link
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Circular Toggle Switch</title> <style> body { display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f0f0f0; font-family: Arial, sans-serif; } .toggle-switch { position: relative; width: 60px; height: 60px; background-color: #ddd; border-radius: 50%; box-shadow: 0 0 15px rgba(0, 0, 0, 0.2); cursor: pointer; transition: background-color 0.3s ease-in-out; } .toggle-switch input { display: none; } .toggle-switch-label { position: absolute; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; } .toggle-switch .toggle-switch-handle { position: absolute; top: 50%; left: 50%; width: 50%; height: 50%; background-color: #fff; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 15px rgba(0, 0, 0, 0.2); transition: transform 0.3s ease-in-out, background-color 0.3s ease-in-out; } .toggle-switch input:checked + .toggle-switch-label .toggle-switch-handle { transform: translate(-50%, -50%) scale(1.2); background-color: #4caf50; } .toggle-switch input:checked + .toggle-switch-label { background-color: #4caf50; } </style> </head> <body> <div class="toggle-switch"> <input type="checkbox" id="toggle7" /> <label class="toggle-switch-label" for="toggle7"> <span class="toggle-switch-handle"></span> </label> </div> </body> </html>