我有这个代码:
/*TOPMENU*/
#menu_wrap{height: 80px; width:80%; float: left; position:relative;}
#topmenu{width:100%; float:left; }
#topmenu ul{ height: 70px; padding:0; position:relative; border-style:solid;
border-width: 1px 0px 1px 0px;} /* height determines distance between 2 border lines */
#topmenu ul li{ float:left; list-style-type:none; margin:15px;}
#topmenu ul li a{ width: 100px; line-height: 22px; text-align:center; display: block; text-decoration:none; color:#a7a9ac; font-size:25px; text-transform:uppercase} /
#topmenu ul.menu > li a:hover{ height: 50px; background:#C8C1B7; color: #fff} //when you hover on menu items
//The line above this is what I'm working on
#topmenu ul .current-menu-item a{ color:#a7a9ac;} // color of HOME font
#topmenu ul .current-menu-item ul li{ background:#1e1e1e;padding:1px 0px;}
#topmenu ul .current-menu-item ul li a{padding:4px; background:none;color:#fff;}
#topmenu ul .current-menu-parent ul .current-menu-item{background:#3e3e3e repeat;}
#topmenu ul .current-menu-parent ul .current-menu-item a{ padding:4px; background:none;}
#topmenu ul .current-menu-parent ul .current-menu-item ul .menu-item a{ padding:4px;}
#topmenu ul .current-menu-item .current-menu-item .sub-menu li a{ padding:4px;background:none;}
#topmenu ul li ul{ position:absolute;width:200px; z-index:999999; display:none; padding-left:0; margin-left:-10px;}
#topmenu ul li ul li{ float:none; margin:0; padding:0px 0px; background:#9F988F ; display:block; }
#topmenu ul li ul li a{ color:#fff; width: 186px;font-size:10px; font-weight:normal; padding:4px;}
/* #topmenu ul li ul li a, #topmenu ul li .sub-menu .current-menu-item a:hover:hover{background:#C8C1B7; color:#ffffff; } */
#topmenu ul li ul li ul{left: 100%; margin-top:-10px; float:none; margin-left:0px; display:none;}
因此,当我将鼠标悬停在主菜单项上时,我试图让它们周围有一个矩形,但这也发生在子菜单项上。如何修改我的代码以使其仅影响主菜单?我正在使用主题模板,所以我没有 HTML,只有 CSS。
提前致谢!