css - 如何在选择子项时将菜单设置为选中状态

标签 css stylesheet

我有一个创建菜单的任务。我想在选择其子项时将菜单设置为选中状态。我的 css 文件是

 #wrapper {
     width:100%;
     height:500px;
 }
 h2 {
     color:#787878;
 }
 #menu, #menu ul {
     list-style: none;
     //padding: 2px;
 }
 #nav{
     border-bottom: 1px solid #CCCCCC;
     border-spacing: 0;
     display: table;
     float: left;
     height: 25px;
     width: 100%;
 }
 #nav ul {
     margin: 0;
     padding: 0;
 }
 #nav > ul > li:hover {
     background: none repeat scroll 0 0 #FFFFFF;
     border-color: #ccc #ccc #FFFFFF;
     border-style: solid;
     border-width: 1px;
     padding-bottom: 0;
     border-radius:1px;
 }
 .menu-child {
     width:160px;
     display:block !important;

 }
 #nav ul li ul li:hover {
 }
 #nav ul li ul :hover { 
 }
 #menu {
     float: left;
     height: 25px;
 }
 #menu> li {
     float: left;
 }
 #menu li a {
     display: block;
     height: 2em;
     line-height: 2em;
     padding: 0 1.5em;
     text-decoration: none;
 }
 #menu ul {
     position: absolute;
     display: none;
     z-index: 999;
 }
 #menu ul li a { 
 }
 #menu li:hover ul {
     display: block;
 }
 #menu {
     font-family: Arial;
     font-size: 12px;
     //background: #F8F8F8;
 }
 #menu > li > a {
     font-family: Verdana, Arial, sans-serif;
     font-style: normal;
     color:#787878;
     font-weight: bold;
 }
 #menu > li > a:hover {
     color: #000;
 }
 #menu ul {
     background: none repeat scroll 0 0 #FFFFFF;
    border-radius: 0 0 5px 5px;
    margin-top: 1px;
 }
 #menu ul li a {
     color: #000;
 }
 #menu ul li a:hover {
     background: #E0E0E0;
 }
 .logout {
     float:right;
     width:300px;
 }
 .title {
     float:left;
     width:300px;
 }
 #footer {
     width:100%;
     height:100px;
     float:left;
 }
 .subchild-list {
     margin:0;

     position: absolute !important;
     top:0;
     right:-87px;
     //border-color: #ccc #FFFFFF #ccc #FFFFFF;
 }
 .child-list ul {
     display: none !important;
     position: absolute !important;
     z-index: 999 !important;
 }
 .child-list li {
     position:relative !important;

 }
 .child-list li:hover ul {
     display: block !important;
 }

.child-list li{

    border-left:1px solid #C0C0C0; 
    border-right:1px solid #C0C0C0;
}

.child-list ul{
    border-top:1px solid #C0C0C0; 
    border-bottom:5px solid #C0C0C0; 
}

.child-list{
    border-bottom:5px solid #C0C0C0; 
}
.nav-subchild
{
    border-color: #ccc #FFFFFF #ccc #FFFFFF;
}
#nav > ul > li:hover {
 border-color: #ccc #ccc #FFFFFF;
 border-style: solid;
 border-width: 1px;
 padding-bottom: 0;
 border-radius:1px;
 }

#menu > li {
border-bottom:#ccc;
border-left: 1px solid #fff;
border-right: 1px solid #fff;
border-top: 1px solid #fff;
}
#nav ul li:hover ul { margin-left:-1px; } #nav ul li ul:hover { margin-left:-1px; }
ul li ul li 
{
    width: 180px;
}
.subchild-list {
    margin:0;
    right:-183px;
    position: absolute !important;
    top:0;
}
.hassub {
    background: url('arrow.gif') right no-repeat;
}

我该如何解决这个问题?

最佳答案

试试这个 字体粗细:粗体;

关于css - 如何在选择子项时将菜单设置为选中状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15136398/

相关文章:

html - Chrome 没有在我的电脑上反射(reflect) css 但其他 chrome 工作正常

html - 如何将一个容器分成多行,每行有不同的列

html - 使用清除 :both 时无法解释的空白

css - 如何在 MOSS/Sharepoint 2007 中为 Web 部件添加样式表

javascript - 如何在 html 中对 <style> 声明进行沙箱处理?

html - 将 <BR> 样式设置为具有类似于 <P> 的边距

html - 对齐段落中留下的一行文本? CSS/HTML

jquery - 在 jQuery .animate 中使用 css 变量

html - 无法让内联图标显示在 CSS 中

css - 如何修复此 CSS 3 代码以使其在服务器上正常工作?