Linear Gradient Progress Bar - 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>Linear Gradient Progress Bar</title> <style> body { display: flex; justify-content: center; align-items: center; height: 100vh; background: linear-gradient(to right, #6a11cb, #2575fc); font-family: 'Arial', sans-serif; margin: 0; } .progress-container { position: relative; width: 80%; max-width: 600px; background: rgba(255, 255, 255, 0.2); border-radius: 20px; padding: 20px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); } .progress-bar { position: relative; width: 100%; height: 30px; background: rgba(255, 255, 255, 0.1); border-radius: 15px; overflow: hidden; box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1); } .progress-bar::before { content: ''; position: absolute; top: 0; left: 0; width: 0; height: 100%; background: linear-gradient(to right, #ff6a00, #ee0979); border-radius: 15px; box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1); animation: progress-animation 5s linear forwards; } @keyframes progress-animation { 0% { width: 0; } 100% { width: 100%; } } .progress-icon { position: absolute; top: 50%; left: 0; transform: translate(0, -50%); font-size: 24px; color: #fff; animation: icon-animation 5s linear forwards; } @keyframes icon-animation { 0% { left: 0; } 100% { left: calc(100% - 24px); } } .progress-label { position: absolute; top: 26px; left: 50%; transform: translateX(-50%); color: #fff; font-weight: bold; } </style> <script src="https://kit.fontawesome.com/a076d05399.js"></script> </head> <body> <div class="progress-container"> <div class="progress-bar"> <div class="progress-icon"> <i class="fas fa-star"></i> </div> </div> <div class="progress-label" id="progress-label">0%</div> </div> <script> const progressLabel = document.getElementById('progress-label'); let progress = 0; function updateProgress() { progress++; progressLabel.textContent = `${progress}%`; if (progress < 100) { setTimeout(updateProgress, 50); } } updateProgress(); </script> </body> </html>