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

css+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" lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>css菜单演示</title>
<link type="text/css" rel="stylesheet" href="css/wenzibuju.css" />
<link href="css/fangkuangbuju.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
*{margin:0;padding:0;border:0;}
body {
        font-family: arial, 宋体, serif;
        font-size:12px;
}
#nav {
         line-height: 70px; list-style-type: none; background:url(../image/djw_nav_bg.jpg) no-repeat;
}
#nav a {
         background:url(../image/djw_nav_libg.jpg) center center no-repeat;
        display: block; width: 80px; text-align:center;
}
#nav a:link {
        color:#666; text-decoration:none;
}
#nav a:visited {
        color:#666;text-decoration:none;
}
#nav a:hover {
        color:#FFF;text-decoration:none;font-weight:bold;
}
#nav li {

        float: left; width: 80px; background:#CCC;  //一级菜单背景色
}
#nav li a:hover{
  
display:block;
color:#000;
}
#nav li ul {
       
        line-height: 27px; list-style-type: none;text-align:left;
        left: -999em; width: 980px; position: absolute; float:inherit;
}
#nav li ul li{
        float: left; width: 80px;
        background: #CCFF00;  //二级菜单背景色
}
#nav li ul a{
        display: block; width: 80px;text-align:center;
}
#nav li ul a:link {
        color:#666; text-decoration:none;
}
#nav li ul a:visited {
        color:#666;text-decoration:none;
}
#nav li ul a:hover {
        color:#F3F3F3;text-decoration:none;font-weight:normal;
        background:#C00;
}
#nav li:hover ul {
        left: 0;
}
#nav li.sfhover ul {
        left: 0;
}
#content {
        clear: left; 
}
-->
</style>
<script type=text/javascript><!--//--><![CDATA[//><!--
function menuFix