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:

original

what happening (the problem): problem

how should be:(instead of increasing width, increases height, , keep whole text) should be

<!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

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -