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

215
Views
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 answers
Answer question

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