Nithin Viswanathan
Nithin Viswanathan

Reputation: 3283

How to change the css of child and subchild menu's border together

I have got a task to create a horizontal menu.Each menu has child and these child has sub child. But when I selecting the sub menu there is a separation between these child and sub child. I want to clear the child right side border when it selected and also discard the first sub child's left border. You can check this on http://jsfiddle.net/ucpcA/. How can i solve this problem? The css page is

 #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;

 }
 /*
 #menu ul li ul {
     border-radius:0px;
     border-color:#fff #ccc #ccc #ccc !important;
 }
 */
 #nav ul li ul li:hover {
     //border:0px;
     //border-color: #ccc #FFFFFF #FFFFFF #ccc;
 }
 #nav ul li ul :hover {
     //border:0px;
     //border-color: #FFFFFF #ccc #ccc;

 }
 #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 {
     /*width: 80px;*/
 }
 #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:-89px;
     //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;
}

enter image description here

Upvotes: 2

Views: 433

Answers (2)

Aratidgr8
Aratidgr8

Reputation: 431

Below 2 css properties will do the needful.

ul#menu li ul.child-list li.menu-child:hover { border-right:0 !important; }

li.menu-child ul li:first-child { border-left:0 !important; }

Upvotes: 2

abbood
abbood

Reputation: 23558

why are you re-inventing the wheel? you can use jquery menu, and if you want it horizontal there are proven ways of doing that as well. I do this whenever I want to solve a very old and classic problem.

the best way to win a battle is by not having to fight one.

Upvotes: 1

Related Questions