positon定位问题

xiaol_zhong 2011-07-22 10:39:49
向各位高手,请教当#extMenu ul中的positon为absolute是就是显示出来的时候链接上方有空白,只有当positon为默认时链接上方地空白没有空白


<html><head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css" charset="utf-8">
* {
margin: 0 auto;
padding: 0;
}
.menu2bg {
background-color: #FCFCFC;
border-bottom: 1px solid #EBEBEB;
height: 28px;
line-height: 28px;
}
.menuUnder {
margin: 0 auto -1px;
}
#extMenu {
background-color: #FFFFFF;
margin: 0;
padding: 0;
text-align: center;
}
#extMenu ul {
background-color: #FCFCFC;
clip: rect(auto, auto, auto, auto);
line-height: 28px;
margin-left: 0;
padding: 0 0 0;
position: absolute;
text-align: center;
width: 980px;
}
#extMenu li a {
color: #333333;
text-decoration: none;
}
#extMenu li {
color: #333333;
font-size: 12px;
list-style: none outside none;
}
</style>
<title></title>
</head><body>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody><tr>


<td class="menu2bg"><table width="980" height="27" cellspacing="0" cellpadding="0" border="0" align="center">
<tbody><tr>
<td>

<div class="menuUnder">
<div onmouseout="hideDiv('topmenu_00','00');" onmouseover="clearTimer();" id="extMenu">
<div style="visibility: hidden; display: none;" name="topmenu_content" id="topmenu_00D">

</div>
<ul class="topmenu_content_nor" name="topmenu_content" id="topmenu_01D" style="display: block;"><li>
<a target="_self" href="#">合作伙伴</a> |
<a target="_self" href="#">信息公开</a> </li></ul>
<ul class="topmenu_content_nor" name="topmenu_content" id="topmenu_02D" style="display: none;"><li>
<a target="_self" href="#">资讯</a> </li></ul>
<ul class="topmenu_content_nor" name="topmenu_content" id="topmenu_03D" style="display: none;"><li>
<a target="_self" href="#">账单</a> |
<a target="_self" href="#">最新动态</a> </li></ul>
<ul class="topmenu_content_nor" name="topmenu_content" id="topmenu_04D" style="display: none;"><li>
<a target="_self" href="#">最新动态</a> </li></ul>

</div>
</div>

</td>
</tr>
</tbody></table></td>
</tr>
</tbody></table>
</body>



另外网站地址http://www.e12345.gov.cn/的顶部的二级菜单中的默认二级菜单“登录公民邮箱 ……

”是一行<tr>,为什么当点击其它tab选项时会把它覆盖,而不是在“登录公民邮箱 ……”这行内容
上面显示,因为其TAB结构为:
<tr>
<td><table><tr><td>
<div class=topmenu><ul>
<li><a onmouseover="show(00)">首页</a></li>
<li><a onmouseover="show(01)">新闻中心</a> </li>
<li><a onmouseover="show(01)">信息公开</a> </li>
<ul><div>
<div class=menuunder>
<div id=topmunu00></div>
<ul id=topmunu01><li>最新动态</li></ul>
<ul id=topmunu02><li>最新信息公开</li></ul>
</div>

</td></tr></table></td>
</tr>


<tr><td>
<table><tr><td>
登录公民邮箱……
</td></tr></table>
</td></tr>
...全文
132 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
numberX 2011-08-01
  • 打赏
  • 举报
回复
firebug里面试着改改
MuBeiBei 2011-07-25
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 xiaol_zhong 的回复:]
引用 6 楼 mubeibei 的回复:

HTML code
<table border=1 cellPadding=0 cellSpacing=0 width= "780 " style=" border-collapse:collapse">
<tr>
<td>
ccc
</td>
<tr>
</table>
<table border=1 cellPadding=0 ………
[/Quote]

不客气~·
xiaol_zhong 2011-07-25
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 mubeibei 的回复:]

HTML code
<table border=1 cellPadding=0 cellSpacing=0 width= "780 " style=" border-collapse:collapse">
<tr>
<td>
ccc
</td>
<tr>
</table>
<table border=1 cellPadding=0 ……
[/Quote]
谢谢,真的可以!
MuBeiBei 2011-07-24
  • 打赏
  • 举报
回复
<table   border=1   cellPadding=0   cellSpacing=0   width= "780 " style="  border-collapse:collapse"> 
<tr>
<td>
ccc
</td>
<tr>
</table>
<table border=1 cellPadding=0 cellSpacing=0 width= "780 " style=" border-collapse:collapse">
<tr>
<td>
ccc
</td>
<tr>
</table>
xiaol_zhong 2011-07-24
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 mokson 的回复:]

通常会忽略的两个问题:
1. 对象没有赋以宽度或高度
2. 对于层,没有指定z轴。即:z-index:数值
[/Quote]
我出现上面那个问题,是由于table里面有ul,ul的postion为:absolute时,会默认有一个top值。
能回答一下我这个问题:

<BODY leftMargin=0 topMargin=0 marginheight= "0 " marginwidth= "0 ">
<center>
<table border=1 cellPadding=0 cellSpacing=0 width= "780 ">
<tr>
<td>
ccc
</td>
<tr>
</table>
<table border=1 cellPadding=0 cellSpacing=0 width= "780 ">
<tr>
<td>
ccc
</td>
<tr>
</table>
</body>
这两个表格之间有一像素的间距,请问如何解决?
ZYLBLCU 2011-07-22
  • 打赏
  • 举报
回复
覆盖是很正常的,通过id可以为内容里的东西写入,通过hover进行判断,这是你问的那个网页里面的内容
ZYLBLCU 2011-07-22
  • 打赏
  • 举报
回复
第二个问题实在没懂,把代码给全
mokson 2011-07-22
  • 打赏
  • 举报
回复
通常会忽略的两个问题:
1. 对象没有赋以宽度或高度
2. 对于层,没有指定z轴。即:z-index:数值
ZYLBLCU 2011-07-22
  • 打赏
  • 举报
回复
不知道你问的是什么问题额……
position=absolute是你的定位取决最近定义的一个position=relative,如果没有定义,就是相对于整个body的位置。
position=stable是默认值,元素会显示到该显示的地方,不能通过top bottom等进行修改其位置

61,115

社区成员

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

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