Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

171
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda