A style attribute on a <progress> tag assigns a unique style to the element.
Its value is CSS that defines the appearance of the progress element.
A style attribute on a <progress> element.
<div>Re-indexing... </div>
<br />
<progress style="width:200px; height:20px;" value="30" max="100"> 30% </progress>
The style attribute specifies the style, i.e. look and feel, of the <progress> element.
A style contains any number of CSS property/value pairs, separated by semicolons (;).
The style attribute overrides any other style that was defined in a <style> tag or an external CSS file.
This inline styling affects the current <progress> element only.
<progress style="CSS-styles">
Value | Description |
---|---|
CSS-styles | One or more CSS property/value pairs separated by semicolons (;). |
A style attribute on a <progress> element.
Clicking the button toggles the width of the element.
<div>Awaiting approval... </div>
<br />
<progress id="myprogress" style="width: 100px; height: 20px;"
value="35" max="100"> 35% </progress>
<br />
<button onclick="toggle();">Toggle style</button>
<script>
let toggle = () => {
let element = document.getElementById("myprogress");
if (element.style.width === "100px") {
element.style.width = "200px";
} else {
element.style.width = "100px";
}
}
</script>
The style attribute assigns a width to the <progress> element.
Clicking the button calls JavaScript which changes the element width.
Here is when style support started for each browser:
Chrome
|
8.0 | Dec 2010 |
Firefox
|
16.0 | Oct 2012 |
IE/Edge
|
10.0 | Sep 2012 |
Opera
|
11.0 | Dec 2010 |
Safari
|
6.0 | Jul 2012 |
Back to <progress>