HTML为什么我的二级菜单会占位置呢?会把网页的其他东西往下顶 20
/*下拉菜单*//*一级*/ul.dropdown{position:relative;width:auto;}ul.dropdownli{font-weight:bol...
/*下拉菜单*/
/* 一级 */
ul.dropdown {
position: relative;
width: auto;
}
ul.dropdown li {
font-weight: bold;
float: left;
width: 100px;
background: #000;
position: relative;
}
ul.dropdown a:hover {
color: #fff;
}
ul.dropdown li a {
display: block;
padding: 0px;
color: #fff;
position: relative;
z-index: 3
}
ul.dropdown li a:hover {
position: relative;
}
/* 二级 */
ul.dropdown ul {
display: none;
position: absolute;
top: 0;
left: 0;
width: 100px;
z-index: 2;
}
ul.dropdown ul li {
font-weight: normal;
background: #000;
color: #fff;
border-bottom: 1px solid #fff;
}
ul.dropdown ul li a {
display: block
}
ul.dropdown ul li a:hover {
display: block
}
-----------------------------------------------------------------------------------------------------
这是菜单
<ul class="dropdown">
<li>
<a><?php
if (@$_SESSION["name"] == "") {
echo '☞快捷登录☜';
} else {
echo "欢迎" . @$_SESSION['name'] . "登录" . " ";
}
?></a>
<ul class="sub_menu">
<li><a href="#">退出登录</a></li>
</ul>
</li> 展开
/* 一级 */
ul.dropdown {
position: relative;
width: auto;
}
ul.dropdown li {
font-weight: bold;
float: left;
width: 100px;
background: #000;
position: relative;
}
ul.dropdown a:hover {
color: #fff;
}
ul.dropdown li a {
display: block;
padding: 0px;
color: #fff;
position: relative;
z-index: 3
}
ul.dropdown li a:hover {
position: relative;
}
/* 二级 */
ul.dropdown ul {
display: none;
position: absolute;
top: 0;
left: 0;
width: 100px;
z-index: 2;
}
ul.dropdown ul li {
font-weight: normal;
background: #000;
color: #fff;
border-bottom: 1px solid #fff;
}
ul.dropdown ul li a {
display: block
}
ul.dropdown ul li a:hover {
display: block
}
-----------------------------------------------------------------------------------------------------
这是菜单
<ul class="dropdown">
<li>
<a><?php
if (@$_SESSION["name"] == "") {
echo '☞快捷登录☜';
} else {
echo "欢迎" . @$_SESSION['name'] . "登录" . " ";
}
?></a>
<ul class="sub_menu">
<li><a href="#">退出登录</a></li>
</ul>
</li> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询