【发布时间】:2014-04-07 21:29:17
【问题描述】:
我需要像上图一样创建css菜单。鼠标悬停在菜单上时必须更改图像和背景。
这是我的菜单代码
HTML
<ul>
<li class="active1"> <a href="profile.html" class="act">My Profile</a></li>
<li><a href="sponsor.html" class="profile1">My Sponsor</a></li>
<li><a href="bankdetails.html" class="profile2">My Payment Information </a></li>
<li><a href="mydocuments.html" class="profile3">My Documents (KYC) </a></li>
</ul>
CSS
tabs ul li a {
color:#5d5c5c;
list-style:none;
text-decoration:none;
font-size:15px;
line-height:25px;
}
.tabs ul li {
list-style:none;
webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
border:1px solid #c3c3c3;
float:left;
background:#e2e3e4;
padding:4px 16px;
}
.active1 {
background:url('../images/profile.jpg') no-repeat left center #004b85 !important;
color:#fff !important;
padding-left:35px !important;
height:40px;
border:none!important;
}
.act {
color:#fff!important;
}
.profile1 {
background: url('../images/profile.png') no-repeat -2px 0;
width: 23px;
height: 15px;
padding-left:25px;
}
.profile2 {
background: url('../images/profile.png') no-repeat -4px -29px;
width: 23px;
height: 18px;
padding-left:25px;
}
.profile3 {
background: url('../images/profile.png') no-repeat -6px -61px;
width: 20px;
height: 20px;
padding-left:25px;
}
主要问题是 css 不是那么动态。我可以使用 jquery 或 css3 获得帮助,以使用 css nth-child 项或 jquery 使其更具动态性????
【问题讨论】:
标签: jquery css menu navigation navbar