如何将数据库结果放在滚动框中


How to place database results in ScrollBox

我正在尝试将我的数据库结果放入 ScrollBox 中,但我遇到了困难,我在网上检查,它说我需要使用scrollbox:auto功能。

但是我也尝试添加有关数据库结果所在的表的CSS。但它不起作用,只是在页面上显示所有结果。

任何指导将不胜感激

.CSS

.results
{
    bottom: -10px;
    position: relative;
    top: 90px;
    scrollbox: auto;    
}

数据库结果

echo "<table class='results' border='1'>";

while ($row = mysqli_fetch_array($result)) 
{       
    echo "<tr >";
    echo "<td>"  . '<img style=height:45px; width:45px src="' . $row['Image'] . '"/>' . "</td>";
    echo "<td>"  . $row['Name'] . "</td>";
    echo "<td>" .  "£" . $row['Cost'] . "<br>" .  '<a href='.$row['Link'].'>' . '</a>' . "</td>";
    echo "</tr>";
}

使用 overflow: auto; Or overflow:scroll 而不是 scrollbox: auto;
确保为滚动div 提供固定高度。