【发布时间】:2011-08-05 22:30:58
【问题描述】:
我有一个 HTML 表格,我希望前几列很长。我在 CSS 中这样做:
td.longColumn
{
width: 300px;
}
这是我的表格的简化版本
<table>
<tr>
<td class='longColumn'></td>
<td class='longColumn'></td>
<td class='longColumn'></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
[ . . and a bunch more columns . . .]
</tr>
</table>
由于某些原因,当有很多列时,该表似乎使该列
表格所在的容器没有任何类型的最大宽度,因此我无法弄清楚为什么它会向下挤压此列而不是尊重此宽度。
无论如何,无论如何,此列都会保持一定的宽度?
这是外部容器 div 的 CSS:
#main
{
margin: 22px 0 0 0;
padding: 30px 30px 15px 30px;
border: solid 1px #AAAAAA;
background-color: #fff;
margin-bottom: 30px;
margin-left: 10px;
_height: 1px; /* only IE6 applies CSS properties starting with an underscrore */
float: left;
/*width: 1020px;*/
min-width:1020px;
display: block;
overflow: visible;
z-index: 0;
}
【问题讨论】:
标签: html css html-table