如何在下拉导航CSS中向子菜单添加第二级 [英] How to add second level to a submenu in a dropdown navigation css
问题描述
我已经创建了下面列出的导航菜单:
I have created the navigation menu listed below:
<div class="menu">
<ul>
<li>
<a href="index.php" target="_self" >Home</a>
</li>
<li>
<a href="preparation.php" target="_self" >Gallery</a>
<ul>
<li>
<a href="digital.php" target="_self">Storybooks</a>
</li>
<li>
<a href="preparation.php" target="_self">Preparation</a>
</li>
<li>
<a href="ceremony.php" target="_self">Ceremony</a>
</li>
<li>
<a href="private.php" target="_self">Personal Shooting</a>
</li>
<li>
<a href="firstdance.php" target="_self">First Dance</a>
</li>
<li>
<a href="details.php" target="_self">Details</a>
</li>
</ul>
</li>
<li>
<a href="login.php" target="_self" >Customers</a>
</li>
<li>
<a href="about.php" target="_self" >About</a>
</li>
<li>
<a href="contact.php" target="_self" >Contact</a>
</li>
</ul>
</div>
此菜单的当前CSS是:
The CSS for this menu at the moment is:
.menu {
margin: 0px;
padding: 0px;
font-family: "Times New Roman";
font-size: 14px;
font-weight: bold;
color: #6D6D6D;
}
.menu ul {
height: 26px;
list-style: none;
margin: 0;
padding: 0;
}
.menu li {
float: left;
padding: 0px;
}
.menu li a {
color: #6D6D6D;
display: block;
font-weight: normal;
line-height: 26px;
margin: 0px;
padding: 0px 25px;
text-align: center;
text-decoration: none;
}
.menu li a:hover, .menu ul li:hover a {
background: #ca9875 url("menu_images/hover.gif") bottom center no-repeat;
color: #6D6D6D;
text-decoration: none;
}
.menu li ul {
/*background:#333333;*/
/*background: #B32267;*/
background: white;
display: none;
height: auto;
padding: 0px;
margin: 0px;
border: 0px;
position: absolute;
/*width: 225px;*/
width: 135px;
z-index: 200;
/*top:1em;
/*left:0;*/
}
.menu li:hover ul {
display: block;
}
.menu li li {
background: url('menu_images/sub_sep.gif') bottom left no-repeat;
display: block;
float: none;
margin: 0px;
padding: 0px;
/*width: 225px;*/
width: 135px;
}
.menu li:hover li a {
background: none;
}
.menu li ul a {
display: block;
height: 26px;
font-size: 13px;
font-style: normal;
margin: 0px;
padding: 0px 10px 0px 15px;
text-align: left;
}
.menu li ul a:hover, .menu li ul li:hover a {
background: #ca9875 url('menu_images/hover_sub.gif') center left no-repeat;
border: 0px;
color: #ffffff;
text-decoration: none;
}
.menu p {
clear: left;
}
我想知道是否有添加第二级子菜单的方法到故事书类别?我的意思是,当我将鼠标悬停在 Storybooks上时,我想在右侧查看另一个子菜单。 CSS可能吗?
感谢您的帮助。
I would like to know if there is a way to add second-level submenu to the category "Storybooks"? What i mean is that I would like to view another submenu in the right while i hover the mouse over the "Storybooks". Is this possible with css? Appreciate any help, thanks.
推荐答案
我在上面编辑了您的代码以使其起作用,请参见 http://jsfiddle.net/BVvc6/1/ 获取新代码。
I edited your code above to make it work, see http://jsfiddle.net/BVvc6/1/ for the new code.
注意:我在故事书下面的故事书1和故事书2下面添加了两个菜单点。CSS已添加到现有代码的底部(上面没有做任何更改)。
Note: I added two menu points below Storybooks called Storybook 1 and Storybook 2. CSS is added to the bottom of the existing code (nothing altered above).
编辑:您应该稍微清理一下CSS代码,例如使用>
之类的CSS选择器来匹配特定的DOM级别。
You should clear up your CSS code a bit, e.g. use CSS selectors like >
to match specific DOM levels.
这篇关于如何在下拉导航CSS中向子菜单添加第二级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!