Gradient Counter - 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>Gradient Counter</title> <style> body { font-family: 'Arial', sans-serif; background: linear-gradient(135deg, #ff9a9e, #fad0c4); display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .counter-container { text-align: center; background: rgba(255, 255, 255, 0.8); padding: 40px; border-radius: 10px; box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1); position: relative; overflow: hidden; } .counter { font-size: 4rem; color: #333; margin: 20px 0; animation: fadeIn 1.5s; } .buttons { display: flex; justify-content: center; gap: 15px; } .button { padding: 10px 15px; font-size: 1.1rem; color: #fff; background: #ff9a9e; border: none; border-radius: 5px; cursor: pointer; transition: background 0.3s, transform 0.3s; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); } .button:hover { background: #fad0c4; transform: translateY(-2px); } .button:active { transform: translateY(0); } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } </style> </head> <body> <div class="counter-container"> <div class="counter" id="counter">0</div> <div class="buttons"> <button class="button" onclick="decreaseCounter()">➖</button> <button class="button" onclick="resetCounter()">🔄</button> <button class="button" onclick="increaseCounter()">➕</button> </div> </div> <script> let counter = 0; const counterElement = document.getElementById('counter'); function updateCounter() { counterElement.textContent = counter; } function increaseCounter() { counter++; updateCounter(); } function decreaseCounter() { counter--; updateCounter(); } function resetCounter() { counter = 0; updateCounter(); } updateCounter(); </script> </body> </html>