Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

170
Views
Bootstrap Progressbar text label issue

I try to use a Bootstrap progress bar to show text on. progress bar works well but the text is not centered to the whole progress bar. Just centered to the gray area. If the progress bar starts to get filled, the text is moving to the right. How I can solve it that the text will stay centered? I use it this way:

        <div class="progress" style="height: 30px">
          <div
            id="theprogressbar"
            class="progress-bar progress-bar-striped bg-success"
            role="progressbar"
            style="width: 0%; transition: none"
            aria-valuenow="0"
            aria-valuemin="0"
            aria-valuemax="100"
          ></div>
          <div id="theprogressbartext" class="d-flex justify-content-center align-items-center h-100 w-100">0/0</div>
        </div>

If I update the text I use it this way:

function setProgressBar(percent, text) {
  $("#theprogressbar").attr("style", "width:" + percent + "%");
  $("#theprogressbar").attr("aria-valuenow", percent);
  $("#theprogressbartext").html(text);
}

Any idea what I do wrong here? I use Bootstrap vom CDN: https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

For all who are interested into the trick:

        <div class="progress position-relative" style="height: 30px">
          <div
            id="theprogressbar"
            class="progress-bar progress-bar-striped bg-success"
            role="progressbar"
            style="width: 0%; transition: none"
            aria-valuenow="0"
            aria-valuemin="0"
            aria-valuemax="100"
          ></div>
          <div
            id="theprogressbartext"
            class="d-flex justify-content-center align-items-center position-absolute h-100 w-100"
          >
            0/0
          </div>
        </div>
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!