我的 html php 文件中有我的表格,我希望将其设置为最大高度,如果它达到最大值并想添加更多,它将是可滚动的,这怎么可能?这是我的元素谢谢
我希望它在达到 500px 后可以滚动
<div class="container" style="max-height: 500px;width:600px;height:500px border:1px solid black">
<div class="panel panel-default" style= "max-height: 500px;">
<div class="panel-heading" align="center">
<img src="or.png" alt="or" style="width:200px;height:40px;">
</div>
<div class="panel-body" style= "max-height: 500px;">
<table class="table">
<tr>
<th><FONT color="CB7F16">Foodname</FONT></th>
<th><FONT color="CB7F16">Quantity</FONT></th>
<tr>
<?php
while($food=mysql_fetch_assoc($list)) {
echo"<tr>";
echo"<td><FONT color='FA9404'>".$food['food']."</FONT></td>";
echo"<td><FONT color='FA9404'>".$food['quantity']."</FONT></td>";
echo"</tr>";
}
?>
<tr>
<td colspan="2" align="center"><a class="btn" href="acceptorder.php">Accept</a></td>
</tr>
</table>
</div>
</div>
</div>
最佳答案
将 overflow-y:auto;
添加到您各自的 div。
关于javascript - 最大高度/行和设置滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32739584/