Speedometer 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>Speedometer Meter</title> <style> body { font-family: 'Arial', sans-serif; display: flex; justify-content: center; align-items: center; height: 100vh; background: linear-gradient(to right, #2C3E50, #4CA1AF); margin: 0; } .meter-container { width: 300px; padding: 20px; background: white; border-radius: 15px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); text-align: center; position: relative; } .meter-title { font-size: 1.2em; margin-bottom: 10px; } .meter { width: 100%; height: 150px; background: #e0e0e0; border-radius: 150px 150px 0 0; overflow: hidden; position: relative; transform: rotate(180deg); } .meter span { display: block; width: 0; height: 100%; background: linear-gradient(to top, #FF6B6B, #556270); animation: fill 4s ease-in-out forwards; } @keyframes fill { 0% { width: 0; } 100% { width: 70%; } /* Adjust this percentage based on your needs */ } .percentage { font-size: 1.2em; margin-top: 10px; color: #FF6B6B; } </style> </head> <body> <div class="meter-container"> <div class="meter-title">Speedometer</div> <div class="meter"> <span></span> </div> <div class="percentage">70%</div> </div> <script> document.addEventListener('DOMContentLoaded', () => { const meter = document.querySelector('.meter span'); const percentage = document.querySelector('.percentage'); let targetPercentage = 70; // Change this value to dynamically set the percentage meter.style.width = `${targetPercentage}%`; percentage.textContent = `${targetPercentage}%`; }); </script> </body> </html>