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

216
Vistas
Resize text on wrap with CSS

I'd like to be able to have text which resizes when it wraps so that the total height of the text block is always the same. In other words, if the text wraps to a second line then the font size becomes half the original, and if it wraps to a third line then it becomes a third of the original, etc. Is this possible in CSS or even with Javascript?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I think you can use media query or 'vw' to do that. For example.

HTML

<div>
  <span class="resizing">Lorem Ipsum...</div>
</div>

CSS using media query

.resizing {
  font-size: 1rem;
  @media screen and (max-width: 800px) {  // You can change this breakpoint
    font-size: 0.5rem;
  }
  @media screen and (max-width: 400px) {  // You can also change this breakpoint
    font-size: 0.33rem;
  }
}

CSS using vw

.resizing {
  font-size: 1vw; // 1vw is 1% of the browser width
  font-size: calc(3px + 1vw); // Or you can do something like this.
}

I wish it helps you.

about 4 years ago · Juan Pablo Isaza 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