I took a unique approach to tackling this issue, offering more detailed insights in another question. Check out my answer here. Here's the gist of it:
To make columns as narrow as possible, simply add the class shrink
.
<table>
<tr><td>first</td><td class="shrink">second</td><td class="shrink">third</td></tr>
<tr><td>first</td><td class="shrink">second</td><td class="shrink">third</td></tr>
<tr><td>first</td><td class="shrink">second</td><td class="shrink">third</td></tr>
</table>
This CSS snippet does the trick:
td.shrink {
white-space: nowrap;
width: 1px;
}
Now you can specify multiple columns to have a minimum width while keeping the others dynamically sized (with potential line breaks).
Take a look at this example snippet:
table {
width: 100%;
}
td {
padding: 10px;
}
td.shrink {
white-space: nowrap;
width: 1px;
}
<table>
<tr><td>first</td><td class="shrink">second</td><td class="shrink">third</td></tr>
<tr><td>first</td><td class="shrink">second</td><td class="shrink">third</td></tr>
<tr><td>first</td><td class="shrink">second</td><td class="shrink">third</td></tr>
</table>