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

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

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 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