[英]Table inside div overflow scroll block
I have a loop records grab from database, I tried to put these records into a div block with overflow to allow user to scroll through a long list for each, somehow when I display below code, the div block are looks disorder without scroll, how can I put table inside div block with overflow? 我有一个从数据库获取的循环记录,我试图将这些记录放入一个溢出的div块中,以允许用户滚动浏览每个长列表,以某种方式,当我在下面的代码中显示时,div块看起来很混乱,没有滚动,如何我可以把表放在有溢出的div块中吗?
<div style="overflow:auto;height:100px;width:358px;">
<table width="100%" border="1" cellpadding="3" cellspacing="0">
<tr>
<td><input id="" class="" name="ids[]" type="checkbox" value="<?php echo $user_email; ?>" /></td>
<td><?php echo $user_name; ?></td>
<td><?php echo $user_email; ?></td>
</tr>
<?php
$query2 = "SELECT * FROM sub_user where parent_user_id=".$row['user_id'];
$result2 = mysql_query($query2);
while($row2 = mysql_fetch_assoc($result2)){
$user_name = stripslashes($row2['user_name']);
$su_position = stripslashes($row2['su_position']);
$su_telephone = stripslashes($row2['su_telephone']);
$user_email = stripslashes($row2['user_email']);
?>
<tr>
<td><input id="" class="" name="ids[]" type="checkbox" value="<?php echo $user_email; ?>" /></td>
<td><?php echo $user_name; ?></td>
<td><?php echo $user_email; ?></td>
</tr>
<?php
}
?>
</table>
</div>
Please advise. 请指教。 thanks.
谢谢。
Did you try this? 你有尝试过吗?
<div style="overflow-y: scroll;height:100px;width:358px">
<table width="100%" border="1" cellpadding="3" cellspacing="0">
<tr>
<td><input id="" class="" name="ids[]" type="checkbox" value="<?php echo $user_email; ?>" /></td>
<td><?php echo $user_name; ?></td>
<td><?php echo $user_email; ?></td>
</tr>
<?php
$query2 = "SELECT * FROM sub_user where parent_user_id=".$row['user_id'];
$result2 = mysql_query($query2);
while($row2 = mysql_fetch_assoc($result2)){
$user_name = stripslashes($row2['user_name']);
$su_position = stripslashes($row2['su_position']);
$su_telephone = stripslashes($row2['su_telephone']);
$user_email = stripslashes($row2['user_email']);
?>
<tr>
<td><input id="" class="" name="ids[]" type="checkbox" value="<?php echo $user_email; ?>" /></td>
<td><?php echo $user_name; ?></td>
<td><?php echo $user_email; ?></td>
</tr>
<?php
}
?>
</table>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.