I am trying to create a table where two of the columns are the smallest width needed to hold the content, and the third column will be as wide as possible. I know how wide the two columns will be and they won't change so much, but I would prefer as little hard coding width as possible.
Here is what I got:
β<table width="100%">
<tr>
<td align="left" style="width:auto;">
123 123 123 123 123
</td>
<td align="center">
bla bla
</td>
<td align="right" style="width:auto;">
hello
</td>
</tr>
</table>ββββββββββββββββββββββββββββββββββββββββββ
The first and last columns take up more space than necessary, causing the middle column to not center. Is there a way to do this, or should I just encode the width?
Edit: The answer is simple. Here is the complete answer if it helps anyone else:
β<table width="100%">
<tr>
<td align="left" style="white-space:nowrap;">
123 123 123 123 123
</td>
<td align="center" width="100%">
bla bla
</td>
<td align="right">
hello
</td>
</tr>
</table>ββββββββββββββββββββββββββββββββββββββββββ
source
share