eflles eflles - 1 year ago 70
HTML Question

How to make IE TD fill entire table width?

I create a HTML table, and sets the width to 900 pixels.
Then I creates 4 columns, and put some text in each cell.

When this appears in Firefox, the four columns fills up the entire table width, but in I8, each column takes the amount of space it requires, and nothing more.

How can I make the four columns in IE use the entire width of the table?

In IE:

| Col1 | Col2 | Col 3 | Col 4|

In Firefox:

| Col1 | Col2 | Col 3 | Col 4 |

Edit: The real problem was that I had one TD at the top of the table, which was set to colspan=99. When this was set to colspan=4, IE used the entire width.

Answer Source

If your table will always have 4 columns, you can set the width explicitly with some CSS:

table td { width: 25%; }