javascript - How do I "justify" a text when a `th`'s text starts pushing the table? -
how justify th's text when text starts pushing table making bigger original size
i'd make table "break line" (aka justify) when can't squeeze other cell anymore.
original:

what happening (the problem): 
how should be:(instead of increasing width, increases height, , keep whole text) 
<!doctype html> <html> <head> <title>my_littlest_table_shop</title> <style> table{ width: 200px; height: 100px; } table, th, td{ border: 1px solid black; } </style> </head> <body> <table> <thead> <tr> <th class="header" align="center">idkajsdhfkjhaksdfhkjashfkjaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaksdfjjjjjj</th> <th class="header" align="center">id</th> </tr> </thead> <tbody> <tr> <td class="header" align="center">id</td> <td class="header" align="center">id</td> </tr> </tbody> </table> <div>----------------200px--------------></div> </body> </html>
these guys should trick:
table { table-layout: fixed; } th, td { /* not sure if want width: 100px; */ word-wrap: break-word; } <!doctype html> <html> <head> <title>my_littlest_table_shop</title> <style> table{ width: 200px; height: 100px; } table, th, td{ border: 1px solid black; } table { table-layout: fixed; } th, td { /* not sure if want width: 100px; */ word-wrap: break-word; } </style> </head> <body> <table> <thead> <tr> <th class="header" align="center">idkajsdhfkjhaksdfhkjashfkjaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaksdfjjjjjj</th> <th class="header" align="center">id</th> </tr> </thead> <tbody> <tr> <td class="header" align="center">id</td> <td class="header" align="center">id</td> </tr> </tbody> </table> <div>----------------200px--------------></div> </body> </html>
Comments
Post a Comment