Ask coding questions

← Back to all posts
[CSS/HTML] How to center text on another div relative to a parent div.
h
Kai_Justice

I'm attempting to make a progress bar for a website, currently I have the text inside the element I'm using for the bar part of the progress bar. ("bar-inner")

JSFiddle for what I currently have:
https://jsfiddle.net/s53y10zc/1/

I want the "10%" and the red progress bar to be on the same level as each other, another requirement is that the "10%" has to be aligned to the center. Does anybody know how to remedy this? I've tried searching online but only solutions for bootstrap come up.

Answered by JustCoding123 [earned 5 cycles]
View Answer
Voters
Kai_Justice
Comments
hotnewtop
JustCoding123

Add

to the styles of .progress-bar

Kai_Justice

@JustCoding123 Was this your expected outcome?

JustCoding123

@Kai_Justice I forgot

Kai_Justice

@JustCoding123 This works! Thank you.