Stylish Meter - 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 Meter</title> <style> body { font-family: 'Arial', sans-serif; background: #f0f2f5; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .meter-container { width: 80%; max-width: 600px; padding: 20px; background: #fff; border-radius: 15px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); text-align: center; position: relative; } .meter-container:before { content: '🔋'; font-size: 4rem; position: absolute; top: -2.5rem; left: 50%; transform: translateX(-50%); } .meter-container h1 { margin-bottom: 20px; color: #333; } .meter { width: 100%; height: 30px; border-radius: 15px; background: #e0e0e0; overflow: hidden; position: relative; border: 2px solid #d1d1d1; } .meter-fill { height: 100%; width: 0; background: linear-gradient(90deg, #56ccf2, #2f80ed); border-radius: 15px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); position: absolute; left: 0; top: 0; transition: width 0.4s ease-in-out; } @keyframes bounce { to { transform: translateY(-10px); } } .meter-value { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: #fff; font-weight: bold; animation: fadeIn 1s forwards; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } .control-buttons { display: flex; justify-content: space-around; margin-top: 20px; } .control-buttons button { background: #2f80ed; color: #fff; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; transition: background 0.3s; font-size: 1rem; } .control-buttons button:hover { background: #56ccf2; } .control-buttons button:focus { outline: none; } .meter-percentage { margin-top: 10px; font-size: 1.5rem; color: #333; } </style> </head> <body> <div class="meter-container"> <h1>Stylish Meter</h1> <div class="meter"> <div class="meter-fill" id="meterFill"> <div class="meter-value" id="meterValue">0%</div> </div> </div> <div class="meter-percentage" id="meterPercentage">0%</div> <div class="control-buttons"> <button onclick="changeMeter(10)">Increase</button> <button onclick="changeMeter(-10)">Decrease</button> <button onclick="resetMeter()">Reset</button> </div> </div> <script> let currentValue = 0; function changeMeter(value) { currentValue += value; if (currentValue > 100) currentValue = 100; if (currentValue < 0) currentValue = 0; const meterFill = document.getElementById('meterFill'); const meterValue = document.getElementById('meterValue'); const meterPercentage = document.getElementById('meterPercentage'); meterFill.style.width = currentValue + '%'; meterValue.textContent = currentValue + '%'; meterPercentage.textContent = currentValue + '%'; } function resetMeter() { currentValue = 0; const meterFill = document.getElementById('meterFill'); const meterValue = document.getElementById('meterValue'); const meterPercentage = document.getElementById('meterPercentage'); meterFill.style.width = '0%'; meterValue.textContent = '0%'; meterPercentage.textContent = '0%'; } </script> </body> </html>