日期:2014-05-16  浏览次数:20354 次

为什么我的overflow做打开时其他内容无法向下递进,而形成重叠?
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>

<script type="text/javascript">

function closewords() {
var dlnodes = document.getElementsByTagName("dl");
for(var i=0; i<dlnodes.length; i++) {
dlnodes[i].className = "close";
}
}

function showwords(dtnode) {
var dlnode = dtnode.parentNode;
if(dlnode.className == "open"){
dlnode.className = "close";}
else{
closewords();
dlnode.className = "open";}
}


</script>
<style type="text/css">
.open{
overflow:visible;}
dl,.close{
height:16px;
overflow:hidden;}
</style>

</head>

<body>

<dl>
<dt onclick="showwords(this)">目录目录目录目录</dt>
<dd>第一目录</dd>
<dd>第一目录</dd>
<dd>第一目录</dd>
<dd>第一目录</dd>
</dl>
<dl>
<dt onclick="showwords(this)">目录目录目录目录</dt>
<dd>第二目录</dd>
<dd>第二目录</dd>
<dd>第二目录</dd>
<dd>第二目录</dd>
</dl>
<dl>
<dt onclick="showwords(this)">目录目录目录目录</dt>
<dd>第三目录</dd>
<dd>第三目录</dd>
<dd>第三目录</dd>
<dd>第三目录</dd>
</dl>
<dl>
<dt onclick="showwords(this)">目录目录目录目录</dt>
<dd>第四目录</dd>
<dd>第四目录</dd>
<dd>第四目录</dd>
<dd>第四目录</dd>
</dl>

</body>
</html>



------解决方案--------------------

.open{
overflow:visible;height:auto;}