我创建了一个表,我希望它是height
be 800px
。
如果它是溢出,我想使滚动条,但标题不滚动。
所以我尝试添加这个CSS:
overflow: scroll;
max-height:800px;
但这对我不起作用。这是整个html文件。有什么问题吗?
CSS
table{
overflow: scroll;
text-align: center;
margin: auto;
max-height:800px;
}
table, td, th
{
border:1px solid green;
}
th
{
background-color:green;
color:white;
}
和HTML
<table >
<tr>
<th>field a</th>
<th>field b</th>
<th>field c</th>
<th>field e</th>
</tr>
<tr>
<td>3534534</td>
<td>עו"ש</td>
<td>6,463</td>
<td>4,000</td>
</tr>
<tr>
<td>3534534</td>
<td>עו"ש</td>
<td>6,463</td>
<td>4,000</td>
</tr>
</table>
谢谢!
https://stackoverflow.com/questions/20293492
复制相似问题