Is there a reason why the "max-width" property does not seem to have any effect on tables in Internet Explorer 7? While it works fine on other elements, when applied to a table, the max-width
rule is completely ignored.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Foo</title>
</head>
<body>
<div style="background-color: Red; max-width: 1000px;">
<table style="background-color: Green; max-width: 500px;">
<tr>
<td><a href="#" class="action view">View</a></td>
<td>7/20/2011</td>
<td>James Smith</td>
<td>345 NW 23rd Ave Gainesville, FL 32606</td>
<td>Alachua Blah blah sf jfh jsdhjs fjsh djkf sdjkhk</td>
<td>345621</td>
<td>Fred Smith</td>
</tr>
</table>
</div>
</body>
</html>
In Firefox, the table with a max-width of 500px functions correctly, breaking text within cells as expected. In IE7, however, it appears as though a "no-wrap" rule has been enforced, causing each cell to expand without attempting to break text within the cell, ultimately ignoring the max-width
rule altogether.
How can I apply the max-width
property to a table in IE7? (The property works in Firefox and IE8)
Attempts that have failed:
table { display: block; }
td { word-wrap: break-word; }
table { table-layout: fixed; }