HTML

Chapter 26: Progress Element

ParameterValue
maxHow much work the task requires in total
valueHow much of the work has been accomplished already
positionThis attribute returns the current position of the <progress> element
labelsThis attribute returns a list of <progress> element labels (if any)

Progress

The <progress> element is new in HTML5 and is used to represent the progress of a task

<progress value="22" max="100"></progress>

This creates a bar filled 22%

Chrome / Safari / Opera

These browsers use the –webkit-appearance selector to style the progress tag. To override this, we can reset the
appearance.

progress[value] {
 -webkit-appearance: none;
 appearance: none;
}

Now, we can style the container itself

progress[value]::-webkit-progress-bar {
 background-color: "green";
}

Firefox

Firefox styles the progress bar a little differently. We have to use these styles

progress[value] {
 -moz-appearance: none;
 appearance: none;
 border: none; /* Firefox also renders a border */}

Internet Explorer

Internet Explorer 10+ supports the progress element. However, it does not support the background-color
property. You’ll need to use the color property instead.

progress[value] {
 -webkit-appearance: none;
 -moz-appearance: none;
 appearance: none;
 border: none; /* Remove border from Firefox */ width: 250px;
 height: 20px;
 color: blue;
}

HTML Fallback

For browsers that do not support the progress element, you can use this as a workaround.

<progress max="100" value="20">
 <div class="progress-bar">
 <span style="width: 20%;">Progress: 20%</span>
 </div>
</progress>

Browsers that support the progress tag will ignore the div nested inside. Legacy browsers which cannot identify the
progress tag will render the div instead.

Recent Posts

Unlocking the Secrets of JSON.stringify(): More Than Meets the Eye

JSON (JavaScript Object Notation) is a lightweight data-interchange format widely used in web development. At…

2 months ago

How to Handle AJAX GET/POST Requests in WordPress

AJAX (Asynchronous JavaScript and XML) is a powerful technique used in modern web development that…

3 months ago

Page Speed Optimization: Post-Optimization Dos and Don’ts

Introduction After successfully optimizing your website for speed, it's essential to maintain and build upon…

3 months ago

Ultimate Guide to Securing WordPress Folders: Protect Your Site from Unauthorized Access

Securing your WordPress folders is crucial to safeguarding your website from unauthorized access and potential…

4 months ago

HTML CSS PHP File Upload With Circle Progress Bar

Creating a file upload feature with a circular progress bar involves multiple steps. You'll need…

4 months ago

Using WP Rocket with AWS CloudFront CDN

Integrating WP Rocket with AWS CloudFront CDN helps to optimize and deliver your website content…

4 months ago