Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

172
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda