By default, what you put in between the <progress></progress>
tags will not show.
<progress class="progress" value="15" max="100">15%</progress>
How would I get the 15% to show? I am using Bulma as a framework.
Use the <progress> tag to create a progress bar in HTML. The HTML <progress> tag specifies a completion progress of a task. It is displayed as a progress bar.
The progress object in HTML DOM is used to represent the HTML <progress> element. The <progress> element can be accessed by using getElementById() method. Property Values: level: It returns the list of progress bar.
A progress bar can be used to show a user how far along he/she is in a process. Bootstrap provides several types of progress bars. A default progress bar in Bootstrap looks like this: 70% Complete.
Use pseudo element and data attribute (works only on chrome ...)
.progress:before {
content:attr(data-text);
}
.progress {
text-align:center;
}
<progress class="progress" value="15" max="100" data-text="15%"></progress>
Or you can simply consider an extra wrapper:
.progress:before {
content:attr(data-text);
position:absolute;
left:0;
right:0;
}
.progress {
text-align:center;
display:inline-block;
position:relative;
}
<div class="progress" data-text="15%"><progress value="15" max="100" ></progress></div>
Including bulma:
.progress-container:before {
content: attr(data-text);
position: absolute;
left: 0;
right: 0;
top:0;
line-height:1em;
}
.progress-container {
text-align: center;
position: relative;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css" rel="stylesheet" />
<div class="progress-container" data-text="15%"><progress class="progress" value="15" max="100"></progress></div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With