I have the following HTML code:
<div class="container">
<table class="table">
<tbody class="tBody">
<tr>
<td>Hellooooooooooooooooooooooooooooooooooooooooooooo</td>
<td>World</td>
</tr>
</tbody>
</table>
</div>
And CSS:
.container {width: 100%;}
.table {display:block;}
.tBody {max-width: inherit;}
My problem is that the total width is defined by a dragbar, so the widths of all the elements must me dynamic. I want the text inside the <td>
element to be able to wrap itself dynamically. So far, the <div>
's width changes its value according to the position of the dragbar. To make it have the <div>
's width, I set the <table>
CSS to display:block
. The rest of the elements in the table, <tbody>
, <tr>
, <td>
, set their width to the widest element in the table, which in this case is the text 'Hellooooooooooooooooooooooooooooooooooooooooo'. So right now, if I move the dragbar to try to make the table smaller, the div
will change its width but the table elements' width will remain the same. Text won't wrap either.
How to make the width of a table (and its children) be set by a dragbar?