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

Advertisement

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

Advertisement

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.

Advertisement
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.

Advertisement

Recent Posts

Securing phpMyAdmin Like a Pro: Essential Tips and Tricks

Securing phpMyAdmin is crucial to prevent unauthorized access and protect your databases. Here's a guide…

5 months ago

Pasqal raises $100M to build a neutral atom-based quantum computer

Pasqal, a Paris-based quantum computing startup, today announced that it has raised a $100 million…

1 year ago

Apple in talks with Disney, others on VR content for new headset: Report

Developed with Sony Group Corp, the headset will have two ultra-high-resolution displays to handle the…

1 year ago

Microsoft, Amazon results to highlight softening cloud business

After years of blistering growth, most recently fuelled by remote working and studying during the…

1 year ago

Intel chairman Omar Ishrak steps down

Omar Ishrak had stepped down and the chipmaker appointed board director Frank Yeary as his…

1 year ago

Canada to commercialise world's first photonic-based quantum computer

Canadian Prime Minister Justin Trudeau has announced a new federal investment to build and commercialise…

1 year ago