Stylish Checkbox - 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>Stylish Checkbox</title> <style> body { font-family: Arial, sans-serif; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f0f2f5; } .checkbox-container { position: relative; display: inline-block; width: 60px; height: 30px; background-color: #ccc; border-radius: 15px; cursor: pointer; transition: background-color 0.3s; } .checkbox-container input { opacity: 0; width: 0; height: 0; } .checkbox-slider { position: absolute; top: 50%; left: 4px; width: 22px; height: 22px; background-color: #fff; border-radius: 50%; transition: transform 0.3s; transform: translateY(-50%); display: flex; justify-content: center; align-items: center; font-size: 16px; color: #666; } .checkbox-container input:checked + .checkbox-slider { transform: translate(26px, -50%); background-color: #4caf50; color: #fff; } .checkbox-container input:checked + .checkbox-slider::before { content: "✔️"; } .checkbox-container input:not(:checked) + .checkbox-slider::before { content: "✖️"; } .checkbox-label { margin-left: 10px; font-size: 18px; color: #555; } .checkbox-container input:checked + .checkbox-slider { animation: bounce 0.3s ease; } @keyframes bounce { 0%, 100% { transform: translate(26px, -50%) scale(1); } 50% { transform: translate(26px, -50%) scale(1.2); } } .tooltip { visibility: hidden; width: 120px; background-color: #555; color: #fff; text-align: center; border-radius: 6px; padding: 5px 0; position: absolute; z-index: 1; bottom: 125%; left: 50%; margin-left: -60px; opacity: 0; transition: opacity 0.3s; } .checkbox-container:hover .tooltip { visibility: visible; opacity: 1; } .tooltip::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px; border-width: 5px; border-style: solid; border-color: #555 transparent transparent transparent; } </style> </head> <body> <div class="checkbox-wrapper"> <label class="checkbox-container"> <input type="checkbox"> <span class="checkbox-slider"></span> <span class="tooltip">Toggle me!</span> </label> <span class="checkbox-label">I agree to the terms and conditions</span> </div> </body> </html>