gpt4 book ai didi

html - 溢出-y : scroll doesn't work for dynamic content

转载 作者:太空宇宙 更新时间:2023-11-04 00:08:24 24 4
gpt4 key购买 nike

我正在尝试动态填充一个 div。 (正在针对 IE9 进行测试。)我正在尝试使用 overflow-y: scroll 这个 div 并将最大高度固定为 300 像素。如果页面是静态的,Overflow-y:scroll 会起作用。如果我的页面是动态的,它不会。我知道首先解析静态部分,然后 php 填充数据。但是在这种情况下我怎样才能让滚动条工作呢?这是我的代码。

<html>
<head>
<style>
#menu_items
{
width:45%;
display:inline;
float:left;
max-height:300px;
overflow-y:scroll;
}
</style>
</head>
<body>
<div id = "menu_items">
<table border = "1">
<?php
//$q = $_GET["q"];
//include 'config.php';
//$sql=sprintf("SELECT * FROM db WHERE id = '%s'",$q);
//$result = mysql_query($sql);
$number = 35;
for($i=0;$i<$number;$i++)
{
echo "<tr>";
echo "<td>Name-id</td>";
echo "</tr>";
}
?>
</table>
</div>
</body>
</html>

最佳答案

尝试使用 css height 属性代替 max-height 并检查结果的差异。

关于html - 溢出-y : scroll doesn't work for dynamic content,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14029571/

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