CSS中的子菜单水平到垂直

时间:2012-09-25 12:02:36

标签: html css drop-down-menu navigation blogger

html中的我的当前菜单导航栏: -

点击此链接可以看到我的博客: - www.4time2fun.com

<div id="topmenu"> 
<div id="navigation">
<ul class="categories">

<li class="articles"> <a href="#Link"><img src="http://4.bp.blogspot.com/-9vOA-2QWrsA/UF7oc4Cgn5I/AAAAAAAAE1k/hVusG2XkwKU/s1600/home.png"></a></li>

<li class="tags mega"><a href="#">Category 4 Fun</a>

<ul class="two">

<li class="tag-item"><a title="#Title" href="#Link">Accessories</a></li> 
<li class="tag-item"><a title="#Title" href="#Link">Automotive</a></li> 
<li class="tag-item"><a title="#Title" href="#Link">Beauty</a></li> 
<li class="tag-item"><a title="#Title" href="#Link">Clothing/Apparel</a></li>

</ul> </li>

<li class="about"><a href="#Link">Team 2 Hire</a>
</li> <li class="about"><a href="# Link">Who We Are</a></li> 
<li class="articles"><a href="#Link">2 Contact Us</a></li>

</ul> </div></div>

Css中的我的当前菜单导航栏: -

#topmenu {
    background: none repeat scroll 0 0 #FBFBFB;
    display: block;
    height: 70px;
    padding-top: 15px;
    text-transform: uppercase;
    width: 990px;
}
#navigation {
    padding: 0 0 5px;
}
#navigation ul li {
    display: inline;
    margin-left: 0;
}
#navigation ul li a {
    padding: 8px 15px;
}
#header #navigation li.mega ul li a {
    font-family: 'Cuprum',arial,serif;
    font-weight: normal;
    text-transform: lowercase;
}
li.mega ul {
    background-color: rgba(255, 255, 255, 0.97);
    border-top: 2px solid #22C3EB;
    padding: 10px 0;
    position: absolute;
    top: 50px;
    z-index: 2;
}
li.mega ul li {
    display: block;
    float: left;
    width: 145px;
}
li.mega ul li a {
    line-height: 30px;
}
#navigation ul li.tags a {
    background: url("http://3.bp.blogspot.com/-ftBEvkZbSMo/TwKvUPTt-II/AAAAAAAAECE/Wrh6HobGwak/s000/arrow_rewards.gif") no-repeat scroll 160px 14px transparent;
    padding-right: 25px;
}
#navigation ul li.tags a:hover {
    background: url("http://3.bp.blogspot.com/-ftBEvkZbSMo/TwKvUPTt-II/AAAAAAAAECE/Wrh6HobGwak/s000/arrow_rewards.gif") no-repeat scroll 160px -10px transparent;
}
#navigation ul li.tags li a, #navigation ul li.tags li a:hover {
    background: none repeat scroll 0 0 transparent;
}
#navigation ul li.tags li a {
    display: block;
    padding: 0 15px;
}
#navigation ul li.tags li a:active {
    border: medium none;
}
#navigation ul li.tags li {
    float: left;
    width: 160px;
}
li.mega ul.two.second {
    display: none !important;
}
li.mega ul {
    left: -9999px;
    position: absolute;
}
li.mega:hover ul, li.mega li ul:hover {
    left: auto;
}
body.category-articles #navigation ul li.articles a, body.category-bestoftheweek #navigation ul li.bestoftheweek a, body.category-about #navigation ul li.about a, body.page-template-page-about-php #navigation ul li.about a, body.page-template-page-contact-php #navigation ul li.contact a {
    background-color: #22C3EB;
    color: #FFFFFF;
}
#topmenu #navigation a {
    color: #616060;
    font-family: 'Cuprum',arial,serif;
    font-size: 18px;
    font-weight: normal;
    text-transform: uppercase;
}
#topmenu #navigation a:hover {
    border-radius: 50px 50px 50px 50px;
    color: #BBBBBB;
}

现在我的子菜单以水平线打开,现在我想在垂直方向创建我的子菜单(类别4乐趣)使用ul class“two”和li class“tag-item”。

1 个答案:

答案 0 :(得分:0)

将此样式添加到您的css代码

.two{
  width:100px;
  margin-left:50px;
 }

DEMO