我试图在我的一个项目中使用剃刀装饰垂直导航菜单,我试图根据功能添加样式但没有成功,问题是我在一张表中都有子类别和类别,这就是为什么我必须打电话一个 ul 中的所有类别、子类别,然后在悬停、活动、非活动等上装饰它们。下面是代码,任何想法为什么粗体声明不起作用。
<div class="listbox">
<ul class="">
@foreach (var category in Model)
{
<li class="@(category.IsActive ? "active" : "inactive")"
@if (category.NumberOfParentCategories > 0)
{
<text>style="background-image: url('/Content/images/cat-ul-li-list.png');border-bottom-style: solid;border-bottom-width:1px; border-bottom-color: #FFFFFF;font-size: 13px;
text-decoration: none;
padding-top: 4px;
padding-left: 15px;color:#5F9E95;min-height:27px;"</text>
}
**@if (category.NumberOfParentCategories > 0 && category.IsActive == true)
{
<text>style="background-image: url('/Content/images/cat-ul-li-active.png') !Important;"</text>**
}><a href="@Url.RouteUrl("Category", new { categoryId = category.Id, SeName = category.SeName })">@category.Name
</a>
</li><li class="separator"></li>
}
</ul>
</div>
CSS:
.block-category-navigation .listbox ul .inactive
{
background-image: url('images/cat-rt-arrow.png');
background-repeat: no-repeat;
background-position: left center;
border-bottom-width: 1px;
border-bottom-color: #5F9E95;
border-bottom-style: solid;
padding-left:15px;
min-height:27px;
padding-top:8px;
}
.block-category-navigation .listbox ul li a:hover { color: #404041; }
.block-category-navigation .listbox ul{ background-image: url('images/cat-ul-active.png') !Important; padding-left:15px;min-height:27px; padding-top: 8px;}
可以在测试网站上看到演示:Quadratech
如果可以使用 css 和 jquery 等其他方法完成,任何建议或帮助将不胜感激。我附上了我正在寻找的图像,其中止血是下面选择的类别是血红素的子类别.. 子类别阻力处于活动状态,底部是其他非活动类别。: