I have a div container that gets filled with changing text elements (via jQuery). That container may not exceed a maximum width (e.g. 200px) and maximum height (e.g. 80px). The basic solution for me is here:
http://jsbin.com/lutejeka/3/edit?html,css
(Note: I used the table only to make the text appear vertically centered. And the borders are there only to see what's going on -> black line is outer edge of available area, red line is the size of the table cell)
Now, as the text length increases it first pushes the width of the table cell to the limit of the div box and only once that max width is achieved the line breaks. I would find it much more aesthetically pleasing if a line break would be forced as soon as a certain aspect ratio of the text is exceeded (say keep width:height of text between 2 and 5 if possible; also, keep length of lines similarly long). Once max height is achieved only width can be increased (once max width is then also achieved the overflowing text will be hidden).
Is there a way to do this? Thank you for taking a look.
to it? – Puzzled Jul 12 '14 at 09:17