Checking For Word Wrap In Table Column
I'm writing part of a web page that allows a user to build a table and fill it with information. In the course of building the table, the user will be adding additional colu开发者_Python百科mns with headers. I'd like to code it so when the combined width of all the headers causes one of them to wrap that the table columns switch to using vertical text (writing-mode: tb-rl). Is there any way, using JavaScript, to determine if the contents of a specific cell have wrapped?
Thanks, Spara
You could create a table with minimal height and your width. You could stick the innerhtml of the other element into your new table. If your new table's height is larger than you'd expect, the text has wrapped, causing the height to increase.
精彩评论