【发布时间】:2013-11-02 22:46:18
【问题描述】:
请考虑这个小而完整的 HTML 块:
<!DOCTYPE html >
<html>
<head>
<title>Test</title>
<style type="text/css">
span {overflow:hidden; white-space:nowrap; }
td {overflow:hidden; text-overflow:ellipsis}
</style>
</head>
<body>
<table cellspacing="0" >
<tbody>
<tr>
<td nowrap="nowrap" style="max-width:30px; width:30px; white-space:nowrap; "><span>column 1</span></td>
<td nowrap="nowrap" style="max-width:30px; width:30px; white-space:nowrap; "><span>column 2</span></td>
<td nowrap="nowrap" style="max-width:30px; width:30px; white-space:nowrap; "><span>column 3</span></td>
</tr>
</tbody>
</table>
</body>
</html>
如果你在 Chrome 中渲染上面的内容,你会看到我正在寻找的效果。
但是在 IE8 或 9 中渲染它,宽度和/或最大宽度被忽略。
所以我的问题是如何让 IE 简单地让我明确指定单元格的宽度? (如果我也不必使用 max-width 来让 Chrome 正常运行,那也很好)。
顺便说一句,我尝试了各种 table-layout:fixed 组合以及使用 colgroup 和 cols 等各种组合,但我没有尝试说服 IE 去做我明确要求它明确做的事情。
【问题讨论】:
标签: html css google-chrome internet-explorer html-table