1 回答
TA贡献1909条经验 获得超7个赞
在div中使用两个表,并使用CSS设置样式。`
<html>
<head>
<style>
#outer_div {
width: 300px;
height: 100px;
overflow: hidden;
}
table {
display: block;
float: left;
margin: 30px 10px 10px 10px;
overflow: scroll;
}
th {
top:10px;
position: fixed;
}
#arts_table {
height: 100px;
}
#cricket_table {
height: 50px;
}
</style>
</head>
<body>
<div id="outer_div">
<table id="arts_table" class="common_table">
<th>ARTS</th>
<tr>
<td>pencil</td>
</tr>
<tr>
<td>color</td>
</tr>
<tr>
<td>brush</td>
</tr>
<tr>
<td>paint</td>
</tr>
<tr>
<td>paper</td>
</tr>
<tr>
<td>glue</td>
</tr>
</table>
<table id="cricket_table" class="common_table">
<th>CRICKET</th>
<tr>
<td>ball</td>
</tr>
<tr>
<td>bat</td>
</tr>
<tr>
<td>wickets</td>
</tr>
<tr>
<td>field</td>
</tr>
<tr>
<td>players</td>
</tr>
<tr>
<td>coach</td>
</tr>
<tr>
<td>audience</td>
</tr>
</table>
</div>
</body>
</html>
添加回答
举报