+ -
当前位置:首页 → 问答吧 → php计算出的导航栏宽度,貌似没控制,求高手帮忙看一下。

php计算出的导航栏宽度,貌似没控制,求高手帮忙看一下。

时间:2011-09-22

来源:互联网

效果,导航菜单,滑动门,用css做的。
PHP code

while($row1=mysql_fetch_array($result1,MYSQL_ASSOC))
    {
        echo"<li><a target='_self' style='width:".$count."px;' href=#>".$row1['Name']."<table><td><tr><div class='inside'>";
        $id=$row1['LevelID'];              //table做定位用
        $sql_2="select * from menu where Level=2 and LevelParentID=".$id;
        $result2=mysql_query($sql_2);
        $con_2=mysql_num_rows(mysql_query($sql_2));
        if($con_2)
        {
        while ($row2=mysql_fetch_array($result2,MYSQL_ASSOC))
        {
            echo"<span><a href='other.html?LevelID=".$row2[LevelID]."' target='_blank'>".$row2['Name']."</a></span>";
        }
        }
        echo"</div></td></tr></table></a></li>";



css样式:
CSS code

.director{
width:930px;
height:35px;
margin:auto;
}
ul{
list-style:none;
}
li{
float:left;
position:relative;
}
table{
position:absolute;
top:0px;
left:0px;
}
a{
display:block;
width:155px;
height:35px;
line-height:35px;
color:#993399;
text-decoration:none;
text-align:center;
}
a:hover{
color:#BD6B09;
cursor:hand;
}
li:hover .inside,
a:hover .inside{
display:block;
position:relative;
left:-2px;
top:0px;
background:#CCC;
}
.inside{
display:none;
}
.inside span a{
background:#ccc;
color:#000;
}
.inside span a:hover{
color:#FFF;
background:#36F;
}

作者: xiaozhumt   发布时间: 2011-09-22

自己搞定了 妈的 差一个padding

作者: xiaozhumt   发布时间: 2011-09-22

热门下载

更多