-1

I'm building media library web app and I want media items listed in a side bar to be fully displayed.

Excel has this neat feature where cells containing strings long enough to overflow automatically adjust the font size to exactly what is needed for the string to remain contained within its padded borders.

I'd like to recreate this with css.

nastetajup
  • 11
  • 1
  • 4

2 Answers2

0

This can't be achieved through CSS alone. Javascript could help you, but it won't be easy.

Try this post: JavaScript Scale Text to Fit in Fixed Div

Community
  • 1
  • 1
benjaminhull
  • 730
  • 6
  • 12
-1

I don't think there is possible to do so. You can, however, create mediaQueries and give different heights or line-heights.

You could use word-wrap: break-word in a div, to make sure the text reorganizes so It won't come out the div's width. However, It would remain with the same size. So, I would definitely use mediaqueries for that

Caro
  • 87
  • 1
  • 11