Trouble Centering Dropdown Navigation
Posted: 16 September 2010 07:32 PM   [ Ignore ]
Newbie
Rank
Total Posts:  1
Joined  2010-09-16

I am having serious issues getting a CSS dropdown navigation menu to center. I have tried everything, but something is pushing it off. If I remove the “Padding=0” from the reset CSS, it moves to the center, but the space on the left and right are not equal. Any advice would be greatly appreciated.

Link to page: http://www.usavgroup.net/DEV/inv/menutest/menuwidthtest.html

CSS:

#menu{
  border:none;
  border:0px;
  font-family: Verdana, Arial, Helvetica, sans-serif;
  font-size:12px;
  width:960px;
  }
#menu ul{
  background: url(../images/nav_background.jpg) #eef3f6;
  height:35px;
  list-style:none;
  text-transform: uppercase;
  }
  #menu li{
      float:left;
      }
  #menu li a{
      color:#072c46;
      display:block;
      font-weight:normal;
      line-height:35px;
      padding:0px 30px;
      text-align:center;
      text-decoration:none;
      }
      #menu li a:hover, .menu ul li:hover a{
        background:url(../images/nav_background_over.jpg);
        color:#FFFFFF;
        text-decoration:none;
        }
  #menu li ul{
      background:#8bb8c6;
      display:none;
      height:auto;
      padding:0px;
      border:0px;
      position:absolute;
      width:225px;
      z-index:200;
      /*top:1em;
      /*left:0;*/
      }
  #menu li:hover ul{
      display:block;
     
      }
  #menu li li {
      background:url(../images/sub_sep.gif) bottom left no-repeat;
      display:block;
      float:none;
      width:225px;
      }
  #menu li:hover li a{
      background:none;
     
      }
  #menu li ul a{
      display:block;
      height:35px;
      font-size:12px;
      font-style:normal;
      text-align:left;
      }
      #menu li ul a:hover, .menu li ul li:hover a{
        background:#2580a2 url(../images/hover_sub.gif) center left no-repeat;
        border:0px;
        color:#ffffff;
        text-decoration:none;
        }
  #menu p{
      clear:left;
      } 
     
     
#menu li.spacer{
  width: 3px;
}

Profile
 
 
Posted: 17 September 2010 12:29 AM   [ Ignore ]   [ # 1 ]
Newbie
Rank
Total Posts:  14
Joined  2010-09-16

Do you use dinamic(generated by a server side script) menu? or why dont you use padding to center the menu ?
I took a sneak peak the the menu and at a first glance I cant come up with any ideas but padding and something with margin:0 auto and width: 85%; (which is practically a complicated padding :)) ).
It’s late and I am tired maybe that;s why I cant find a solution :D.

_____________________
jocuri masini | my blog

Profile
 
 
Posted: 03 October 2010 06:13 PM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  5
Joined  2010-10-03

I have the same problem. I’ve tried all variants. Please help me to find the right answer.

Profile