我希望我的子菜单向右滑动,我尝试了其他一些css菜单,但它在我的网页中创建了问题。 这是菜单的html页面
<li class="widget">
<h2>Categories</h2>
<ul>
<li><a href="index.php" title="Category 1">All </a></li>
<li><a href="search.php?category=Groceries" title="Category 1">Groceries</a></li>
<li><a href="search.php?category=Personal_care" title="Category 2">Personal Care</a></li>
<li><a href="search.php?category=Dining" title="Category 5">Dining</a></li>
<li><a href="search.php?category=entertainment" title="Category 7">Entertainment</a></li>
<li><a href="search.php?category=travel" title="Category 6">Travel </a></li>
<li><a href="search.php?category=Books_Magazine" title="Category 3">Books & Magazine</a></li>
<li><a href="search.php?category=clothing" title="Category 4">Clothing</a></li>
<li><a href="search.php?category=Sport_Fitness" title="Category 9">Sport & Fitness</a></li>
<li><a href="search.php?category=other" title="Category 11">Other</a></li>
<li></li>
</ul>
</li>
这是我菜单的css,如何添加css以在右侧创建一个drowp down子菜单
.widget { padding-bottom: 16px; }
.widget h2 {
height: 37px;
line-height: 37px;
background: url('images/widget-title.png') no-repeat 0 0;
font-family: 'Museo500', arial, sans-serif;
font-size: 18px;
color: #fff;
font-weight: normal;
padding: 0 9px 5px 22px;
}
.widget li a {
background: #6692C6;
line-height: 26px;
height: 26px;
padding-left: 23px;
font-size: 13px;
border-bottom: 1px solid #fff;
color: #EEEEEE;
display: block;
}
.widget li.last a { border: none; }
.widget li a:hover {
color: #333333;
background: #fff;
text-decoration: none;
font-weight: bold;
}
答案 0 :(得分:0)
了解这是如何运作的
<强> HTML 强>
<li class="widget">
<h2>Categories</h2>
<div class='subMenu'>
<ul>
<li><a href="index.php" title="Category 1">All </a></li>
<li><a href="search.php?category=Groceries" title="Category 1">Groceries</a></li>
<li><a href="search.php?category=Personal_care" title="Category 2">Personal Care</a</li>
</ul>
</div>
</li>
<强> CSS 强>
.subMenu{
display:none;
}
.widget:hover .subMenu{
display:block;
}
<强>拨弄强>