IE67的问题,有滚动条容器中表格中的relative容器被隐藏了

superzmy凄临雨 2009-08-01 04:12:56
以下是代码
现在问题是,在一个具有overflow-y:auto的容器中
有relative div、内部有一个表格、表格内又有一个设置position非auto的div,这个div被隐藏了


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="zh-CN">

<head profile="http://gmpg.org/xfn/11">
</head>

<body style="font-size:12px">
<div style="height:468px;overflow-y:auto;position:relative;">
<div style="position:relative;">
<div style="background-color:#808080;height:140px;width:130px;position:relative;">
方块一,显示出来了
</div>
<table width="580">
<tr>
<td width=130px>
<div style="background-color:grey;height:140px;width:130px;position:auto;">
方块二,应该能显示
只有position:不设置或auto能显示
</div>
<div style="background-color:green;height:140px;width:130px;position:relative;">
方块三,应该是被隐藏了
position:relative的容器是我需要的
如果被隐藏,用IE8附带的开发人员工具随便把背景色之类的CSS禁止再启用就看见了
</div>
<div style="background-color:blue;height:140px;width:130px;position:absolute;">
方块四,应该是被隐藏了
</div>

</td>
<td width="430px" style="background-color:#AA00FF;">
<div style="background-color:#000;height:140px;position:relative;">
长条的
</div>
</td>
</tr>
<tr height="300px">
<td/>
<td>
把滚动条拉出来(要overflow=auto才有会问题)
</td>
</tr>
</table>
</div>
</div>
</body>
</html>
...全文
109 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
superzmy凄临雨 2009-08-01
  • 打赏
  • 举报
回复
我自己提供一个解决方案……这个方案让我很无语!!!!
body onload中
通过document.getElementById("被隐藏的一个div").style.position="absolute"; 再设置成relative
然后就显示出来了……而且不只这个div被显示出来,其他的div也可能被显示出来
但是有一个div有的时候会显示有的时候不会显示……(不改源代码,仅仅刷新)


superzmy凄临雨 2009-08-01
  • 打赏
  • 举报
回复
问题很奇怪!!!
在firefox里面都是正确的
在ie6\7里面最里层relative的div被隐藏了!
但是用ie8的开发人员工具修改一下背景颜色什么的,那个div马上就显示出来了
说明代码没错……

61,112

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧