【发布时间】:2012-08-10 14:58:59
【问题描述】:
我希望我的分类框只显示子分类
喜欢
main category
subcategory 1
subcategory 1_1
subcategory 1_2
subcategory 1_3
subcategory 2
subcategory 2_1
subcategory 2_2
subcategory 3
subcategory 4
我想这样显示
subcategory 1
subcategory 2
subcategory 3
subcategory 4
这是我的 HTML 代码,我正在使用 css 隐藏父类别 但我不明白如何在 草药产品
下隐藏 Shop by Brand 和 Concentrated Powders<div class="sideBoxContent" id="categoriesContent">
<a href="index.php?main_page=index&cPath=2" class="category-top">
<span class="category-subs-parent">Product</span>
</a>
<br>
<a href="index.php?main_page=index&cPath=2_4" class="category-subs"> Accupuncher Niddels
</a>
<br>
<a href="index.php?main_page=index&cPath=2_7" class="category-subs">
<span class="category-subs-parent"> Herbal Products</span>
</a>
<br>
<a href="index.php?main_page=index&cPath=2_7_9" class="category-products"> Concentrated Powders
</a>
<br>
<a href="index.php?main_page=index&cPath=2_7_8" class="category-products"> Shop by Brand
</a>
<br>
<a href="index.php?main_page=index&cPath=2_10" class="category-products"> Magnets, Pellets & Tapes
</a>
<br>
<a href="index.php?main_page=index&cPath=2_3" class="category-products"> New Arrival
</a>
<br>
<hr id="catBoxDivider">
</div>
我的css是这样的
A.category-subs, A.category-subs:visited {
color: #FF0000;
text-decoration: none;
}
A.category-products, A.category-products:visited
{
display: none;
}
但我没有得到正确的输出,因为它隐藏了所有类别产品,我希望它只隐藏我上面提到的两个
提前致谢
【问题讨论】:
-
1.将
<ul>和<li>用于列表。 --- 2. 嵌套<ul>标签以创建子项。 --- 3. 不要使用&nbsp;来缩进子项目。相反,嵌套的<ul>会给你这个效果。 --- 查看mcli.dist.maricopa.edu/tut/tut6.html 示例 -
感谢您的建议,但我有此代码以及如何从此代码中隐藏 Shop by Brand 和 Concentrated Powders 下 草药产品请帮助我@Aziz
-
使用您的 HTML,您无法做到这一点,因为即使您隐藏了所有子菜单
<a>s,您仍然可以看到<br>标记,这将在您的菜单项之间产生间隙。您需要先改进您的 HTML,然后 CSS 将是小菜一碟。 -
好的,谢谢你的帮助...@Aziz
标签: html css html-lists zen-cart