我创建了一个没有bootstrap的菜单栏,问题是下拉列表中的下拉z-index在下面有图像时没有工作我已经给出了图像和菜单的相对和绝对位置,任何人都可以帮忙吗? / p>
码
<ul id="nav">
<li class="current"><a href="#">Home</a></li>
<li><a class="nolink">MASTER</a>
<ul>
<li><a href="master_textile.php">TEXTILE</a></li>
<li><a href="master_nontextile.php">NON-TEXTILE</a></li>
<li><a href="branch_name_master.php">BRANCH NAME</a></li>
<li><a href="initial_stock.php">INITIAL STOCK - TEXTILE</a></li>
<li><a href="initial_stock_non_textile.php">INITIAL STOCK - NON TEXTILE</a></li>
<li><a href="initial_stock_silk.php">INITIAL STOCK - SILK</a></li>
<li><a href="customer_details_master.php">CUSTOMER DETAILS</a></li>
<li><a href="percent.php">PERCENT</a></li>
</ul>
</li>
<li><a class="nolink">PURCHASE</a>
<ul>
<li><a href="purchase_textile.php">TEXTILE</a></li>
<li><a href="purchase_silk_textile.php">SILK</a></li>
<li><a href="purchase_nontextile.php">NON-TEXTILE</a></li>
</ul>
</li>
<li><a class="nolink">RETAIL SALE</a>
<ul>
<li><a href="retail_sales.php">TEXTILE</a></li>
<li><a href="retail_sales_silk.php">SILK</a></li>
<li><a href="retailsale_nontextile.php">NON-TEXTILE</a></li>
</ul>
</li>
<li><a class="nolink">WHOLE SALE</a>
<ul>
<li><a href="whole_sales.php">TEXTILE</a></li>
<li><a href="whole_sales_silk.php">SILK</a></li>
<li><a href="whole_nontextile.php">NON-TEXTILE</a></li>
</ul>
</li>
<li><a class="nolink">RETURN BILLS</a>
<ul>
<li><a href="retail_textile_cancel_bill.php">RETURN BILL - TEXTILE</a></li>
<li><a href="silk_return_bill.php">RETURN BILL - SILK</a></li>
</ul>
</li>
<li><a class="nolink">SUMMARY</a>
<ul>
<li><a class="nolink">BILL SUMMARY</a>
<ul>
<li><a href="Summary_textile.php">RS - TEXTILE</a></li>
<li><a href="summary_nontextile.php">RS - NON-TEXTILE</a></li>
<li><a href="wholesale_summary_textile.php">WS - TEXTILE</a></li>
<li><a href="wholesale_summary_nontextile.php">WS - NON-TEXTILE</a></li>
<li><a href="purchase_summary_textile.php">PU - TEXTILE</a></li>
<li><a href="purchase_summary_nontextile.php">PU - NON-TEXTILE</a></li>
</ul>
</li>
<li><a class="nolink">STOCK BOOK</a>
<ul>
<li><a href="stockbook.php">TEXTILE</a></li>
<li><a href="stockbook_silk.php">SILK</a></li>
<li><a href="stockbook_nontextile.php">NON-TEXTILE</a></li>
</ul>
</li>
<li><a class="nolink">ALTER</a>
<ul>
<li><a href="paisa_alter.php">PAISA - ALTER</a></li>
<li><a href="summary_date_alter.php">DATE - ALTER</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="nolink">LOAN</a>
<ul>
<li class="dropdown_submenu non"><a href="#">TEXTILE</a>
<ul>
<li><a href="loanlist.php">VIEW LOAN LIST</a></li>
<li><a href="loan_personal_list.php">PERSONAL LIST</a></li>
<li><a href="loancr.php">LOAN CR</a></li>
</ul>
</li>
<li><a href="">NON-TEXTILE</a>
<ul>
<li><a href="loan_list_nontex.php">PERSONAL LIST</a></li>
<li><a href="loan_cr_nontex.php">LOAN CR</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="nolink">REPORT</a>
<ul>
<li><a href="#">TEXTILE</a>
<ul>
<li><a href="initial_tex_report.php">INITIAL</a></li>
<li><a href="closing_tex_report.php">CLOSING</a></li>
</ul>
</li>
<li><a href="#">NON-TEXTILE</a>
<ul>
<li><a href="initial_nontex_report.php">INITIAL</a></li>
<li><a href="closing_nontex_report.php">CLOSING</a></li>
</ul>
</li>
</ul>
</li>
</ul>
的CSS:
a {
color: #3bb3a9;
}
#nav {
padding: 2px 4px 0;
line-height: 100%;
background:#3bb3a9; /* for non-css3 browsers */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#3bb3a9', endColorstr='#3bb3a9'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#3bb3a9), to(#3bb3a9)); /* for webkit browsers */
background: -moz-linear-gradient(top, #3bb3a9, #3bb3a9); /* for firefox 3.6+ */
border: solid 1px #329c92;
}
#nav li {
margin: 0 10px;
padding: 0 0 5px;
float: left;
position: relative;
list-style: none;
}
/* main level link */
#nav a {
font-weight: bold;
color: white;
text-decoration: none;
display: block;
padding: 4px 10px;
margin: 0;
-webkit-border-radius: 1.6em;
-moz-border-radius: 1.6em;
}
/* main level link hover */
#nav .current > a, #nav li:hover > a {
background:#329c92; /* for non-css3 browsers */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#329c92', endColorstr='#329c92'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#329c92), to(#329c92)); /* for webkit browsers */
background: -moz-linear-gradient(top,#329c92, #329c92); /* for firefox 3.6+ */
color: white;
}
/* sub levels link hover */
#nav ul li:hover a, #nav li:hover li a {
background: none;
border: none;
color: white;
-webkit-box-shadow: none;
-moz-box-shadow: none;
cursor:pointer;
}
#nav ul a:hover {
background: #329c92 !important; /* for non-css3 browsers */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#329c92', endColorstr='#329c92'); /* for IE */
background: -webkit-gradient(linear, left top, right bottom, from(#329c92), to(#329c92)) !important; /* for webkit browsers */
background: -moz-linear-gradient(top, #329c92, #329c92) !important; /* for firefox 3.6+ */
color: white !important;
-webkit-border-radius: 0;
-moz-border-radius: 0;
}
/* level 2 list */
#nav ul {
background: #3bb3a9; /* for non-css3 browsers */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#3bb3a9', endColorstr='#3bb3a9'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#3bb3a9), to(#3bb3a9)); /* for webkit browsers */
background: -moz-linear-gradient(top, #3bb3a9, #3bb3a9); /* for firefox 3.6+ */
display: none;
margin: 0;
padding: 0;
width: 185px;
position: absolute;
top: 27px;
left: 0;
border: solid 1px #3bb3a9;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
}
/* dropdown */
#nav li:hover > ul {
display: block;
}
#nav li ul.stayopen {
display: block !important;
}
#nav li ul.stayopen li a {
color: white;
}
#nav ul li {
float: none;
margin: 0;
padding: 0;
}
#nav ul a {
font-weight: normal;
}
/* level 3+ list */
#nav ul ul {
left: 181px;
top: -3px;
}
/* rounded corners for first and last child */
#nav ul li:first-child > a {
-webkit-border-top-left-radius: 9px;
-moz-border-radius-topleft: 9px;
-webkit-border-top-right-radius: 9px;
-moz-border-radius-topright: 9px;
}
#nav ul li:last-child > a {
-webkit-border-bottom-left-radius: 9px;
-moz-border-radius-bottomleft: 9px;
-webkit-border-bottom-right-radius: 9px;
-moz-border-radius-bottomright: 9px;
}
/* clearfix */
#nav:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
#nav {
}
html[xmlns] #nav {
display: block;
}
* html #nav {
height: 1%;
}
答案 0 :(得分:1)
为下一级导航添加z索引,如下所示。
#nav ul
{
z-index:999 !important;
}
答案 1 :(得分:0)
我已经找到答案,它现在正在工作......
#nav li {
margin: 0 10px;
padding: 0 0 5px;
float: left;
position: relative;
list-style: none;
z-index:1;
}
在css中添加此代码。