我有一个固定前4列的表,所有滚动都是静止的。 对于此代码如下:
<table border="1" cellspacing="1" cellpadding="1" id="outerTable">
<thead valign="top">
<tr>
<td>S.No.</td>
<td>Agent </br>name</br> </td>
<td>Port / Offices</td>
<td>Address</td>
</tr>
<?php
while($row1 = mysql_fetch_assoc($agent_res))
{
?>
<tr valign="middle">
<td><?php echo $row1['agent_no'] ?></td>
<td><?php echo $row1['agent_name'] ?></td>
<td><?php echo $row1['port'] ?></td>
<td><?php echo $row1['address'] ?></td>
</tr>
<?php
}
?>
</thead>
<tbody valign="top">
<tr>
<td>Tel</td>
<td>Fax</td>
<td>Contact</td>
<td>Email Address</td>
<td>Website Address</td>
<td>Strength Ocean Air BB</td>
<td>Communication / Response Time</td>
<td>Rate Competitiveness</td>
<td>Expertise in Execution</td>
<td>Nominations</td>
<td>Financial Dealing</td>
<td>Country Network</td>
<td>Network Assoc.</td>
<td>Agency Agreement</td>
<td>Average Score</td>
<td>Origin Charges</td>
<td>Destn Charges</td>
</tr>
<?php
mysql_data_seek($agent_res, 0);
while($row2 = mysql_fetch_assoc($agent_res))
{
?>
<tr>
<td><?php echo $row2['tel'] ?></td>
<td><?php echo $row2['fax'] ?></td>
<td><?php echo $row2['contact'] ?></td>
<td><?php echo $row2['email_id'] ?></td>
<td><?php echo $row2['website_address'] ?></td>
<td><?php echo $row2['strength_ocean_air_bb'] ?></td>
<td><?php echo $row2['communication_or_responce_time'] ?></td>
<td><?php echo $row2['rate_competitiveness'] ?></td>
<td><?php echo $row2['expertise_in_execution'] ?></td>
<td><?php echo $row2['nominations'] ?></td>
<td><?php echo $row2['financial_dealing'] ?></td>
<td><?php echo $row2['country_network'] ?></td>
<td><?php echo $row2['network_assoc'] ?></td>
<td><?php echo $row2['agency_agreement'] ?></td>
<td><?php echo $row2['avg_score'] ?></td>
<td><?php echo $row2['origin_charges'] ?></td>
<td><?php echo $row2['destination_charges'] ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
CSS:
table#outerTable thead, table#outerTable tbody {
display:inline-block;
}
table#outerTable tbody {
width: 500px;
overflow-x: scroll;
}
我得到的输出如下:
行未显示在<thead>
和<tbody>
的同一行中。
我希望<thead>
和<tbody>
中的行高相同。
所以任何人都可以在这方面帮助我。
提前致谢。
等待你的回复。