gpt4 book ai didi

html - 如何向我的表格添加滚动条?

转载 作者:行者123 更新时间:2023-11-28 00:02:44 25 4
gpt4 key购买 nike

我想让我的 table 有一个滚动条,这样页面就不会太高,我尝试了很多我搜索过的答案,但没有任何反应。这是我的代码。

  <div class="text">List Of Product </div>
<div id="tableContainer" class="tableContainer">
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="scrollTable">
<thead class="fixedHeader">
<tr>
<th>Image</th>
<th>Item Name</th>
<th>Item Price</th>
<th>Item Description</th>
<th></th>
</tr>
</thead>
<?php
include('config.php');
$result2 = mysql_query("SELECT * FROM category");
while ($row2 = mysql_fetch_array($result2)) {
$ble = $row2['id'];
$result3 = mysql_query("SELECT * FROM athan_products where product_id='$ble'");
echo '<tbody class="scrollContent">';
echo "<tr>";
while ($row3 = mysql_fetch_array($result3)) {
echo '<td class="templatemo_pizza_box"><img alt="Motor" src="images/motor/' . $row3['product_photo'] . '" width="65px" height="65px" /></a></td>';
echo '<td class="textbox"> ' . $row3['partsname'] . ' </td>';
echo '<td class="textbox"> ' . $row3['price'] . ' </td>';
echo '<td class="textbox"> ' . $row3['description'] . ' </td>';
echo '<td><a rel="facebox" href=portal.php?id=' . $row3["product_id"] . '><input type="submit" value="Add to Cart"/></td>';
}
echo '</tr>';
echo "</tbody>";
}
?>
</table>
</div>

最佳答案

对于您要滚动的元素,您需要提供高度,以及当它溢出该高度时会发生什么。例如:

<table style="height:20px;overflow-y:scroll">....</table>

当内容高度超过20px时会导致表格有滚动条

关于html - 如何向我的表格添加滚动条?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20415065/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com