I’m trying to modified a code to do something a bit different but I can’t get it to work. This is the code:
<div id="progress-bar" class="all-rounded">
<div id="progress-bar-percentage" class="all-rounded" style="width: 88%">88/100</div>
</div>
This renders:

Using this CSS:
.all-rounded {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.spacer {
display: block;
}
#progress-bar {
width: 100px;
background: #cccccc;
}
#progress-bar-percentage {
background: #3063A5;
padding: 5px 0px;
color: #FFF;
text-align: center;
}
As you can see the text 88/100 is printed inside the inner div progress-bar-precentage so is centered relative to this div, the problem with this is if progress-bar-precentage width is very small the text will be out of place, my idea is to center it relative to the outter div progress-bar so it will always be in place regardless of the inner div, but i have no idea how to put the text on top and center, any ideas?
Try this – DEMO
HTML
CSS