水平线阻止子菜单

时间:2013-07-13 10:55:12

标签: html css menu submenu

我正在组织我的header.html,但是因为我为下拉菜单插入了代码,所以水平线条是一个图像正在阻止子菜单..有没有办法把蓝色条放在后面子菜单?

了header.html

<!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" charset="utf-8;" content="text/html" />



<link rel="stylesheet" type="text/css" href="styles.css" />

</head>

<body>

    <d
</html>

CSS

{
    font-family: verdana,sans-serif; 
}

div {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

.container {
    border-collapse: collapse;
    position: relative;
    min-height: 90%;
    height: auto !important;
    height: 90%;
    margin: 0;
    min-width:800px;
    width: 800px;
}

#left-panel, #right-panel {
        border-collapse: collapse;
        display:inline-block;
        width:30em;
        height:100%;
        margin:0px;
        min-width:100px;
        background:white;
        overflow:hidden;
}
.header {
    margin: 0 auto;
    width: 800px;
    height: auto;
    border-collapse: collapse;
}

.footer, .push  {
    width:800px;
    height: 40px;
    clear: both;
    margin: 0 auto 0;
}

p.copyright {
    font-weight: bold;
    text-align: center;
}

.text-image{
    width:533px;
    height:321px;
    background-image: url('images/about-cti.jpg'); 
    background-position: 350px 250px; 
}

.a {
        text-align: left;
        font-family: verdana;
        font-size: 11pt;
        text-decoration: none; 
        color : #000000;
} 
<!--Navigation-->
#cssmenu ul,
#cssmenu li,
#cssmenu span,
#cssmenu a {
  margin: 0;
  padding: 0;
  position: relative;
}
#cssmenu {
    list-style:none;
    float:right;
}
#cssmenu ul {
  list-style: none;
}
#cssmenu > ul > li {
  float: left;
}
#cssmenu ul ul {
  display: none;
  position: absolute;

  left: -1px;
  min-width: 100%;
  text-align: center;  
  *width: 100%; /* IE7 hack*/
}
#cssmenu li:hover ul {
  display: block;
}
<!--End of Navigation-->

3 个答案:

答案 0 :(得分:1)

将此css添加到水平线:

z-index: -1;
margin-top: 2px;

或者:

z-index: 20;

<ul>

margin-top: 2px;

到你的行

或者:

li, ul {
    z-index: 20;
}

另请注意对此div的更改:

<div style="background: url('images/heading-top.jpg') repeat-x; height: 20px; margin-bottom:0; position: relative; top:86px;margin-top: 2px;"></div>

答案 1 :(得分:0)

您只需在子菜单z-index:900元素中添加ul(不必为900,但相对较高)。

答案 2 :(得分:0)

这是解决方案:

#cssmenu ul { z-index:1;}

希望它有效。