php - Fill CSS box with text from MySQL till there is no overflow, scrollbar, or hidden text -


I want to fill a CSS box with text unless there is no overflow or scrollbar. To get the text from MySQL, the user clicks on a button and the next bit will fill the text box. To do this, I have put the only way, parse through the text and count the characters and the new lines etc. And calculate whether it will fit in the box or not. Is there an easier way to do this? Thanks

There is no reliable way to figure out how much text will fit in a DOM element.

However, I'm pretty sure why to set only overflow: hidden on the box will not be enough

Whatever overflow happens, it will be cut (which is, hidden) Will happen).


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -