testndtv testndtv - 1 month ago 9
CSS Question

Issue with HTML <table> widths

I have a

<table>
with 3 columns as:



table {
border: 1px dashed goldenrod;
}
td {
border: 1px solid gray;
}

<table>
<tr>
<td width="120">Some content</td>
<td width="150">Some content</td>
<td width="100%">Some content</td>
</tr>
</table>





Now the 3rd column ise set to occupy the remaining width..But in my case, while it does stretch and occupy remaining width, it squeezes the first 2 columns...

If I do not give any width to the 3rd column/td, I am able to see the specified width for the first 2 columns..

Please help me.

The table has already been set with width="100%"

Answer

Leave the last column without width, and set table width to 100% or desired table width.