I've put together a pure CSS drop down menu for my site. It worked beautfully, until I found that if you had a large DPI setting, menu items started falling off and disappearing. So I rearranged the menu so there were fewer items on the main menu. Now at the larger DPI nothing falls off. Unfortunatly, now the menu, which is all left aligned, doesn't look as nice as it used too. I'm trying to figure out how to get all the top level menu items to appear centered. I've tried margin-left:auto; and margin-right:auto; just about everywhere and in just about evey combination I could think of but no matter what I try it doesn't seem to work. I'm hoping a new set of eyes on the code might be able to point out what I'm missing.
Here is the code
Note: everything that is a #nav falls in the div.Navigation, which is why I included it.
Anyone see what I'm missing as to why I can't get the top level menu items to center?
Here is the code
Code:
div.Navigation {
clear:both;
margin-top: -10px;
#margin-top:auto;
}
#nav {
margin: 0;
padding: 0;
height: 22px;
background-image:url(../Images/bar_solid_purple-slice.png);
background-repeat:repeat;
}
#nav ul {
margin:0;
padding:0;
}
#nav li {
list-style:none;
float:left;
}
#nav li a {
display:block;
width: 7em;
background-image:url(../Images/bar_solid_purple-slice.png);
background-repeat:repeat;
color:#fff;
text-decoration:none;
text-align:center;
}
#nav li a:hover {
background-image:url(../Images/Nav_bar_slice_over.png);
background-repeat:repeat;
}
#nav li ul {
display:none;
width:100px;
background-color: #23473d;
margin-left:25px;
}
#nav li ul a {
width:120px;
padding-top:3px;
padding-right:0px;
padding-bottom:3px;
padding-left:8px;
text-align:left;
font-size:smaller;
}
#nav li ul ul {
margin: -16px 0px 0px 100px;
}
#nav li:hover ul ul, #nav li:hover ul ul ul, #nav li.sfhover ul ul, #nav li.sfhover ul ul ul {
display:none;
}
#nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul, #nav li.sfhover ul, #nav li li.sfhover ul, #nav li li li.sfhover ul {
display:block;
position:absolute;
z-index:1;
}
#nav li:hover li a, #nav li.sfhover li a {
background-color:#69f;
border-bottom:1px solid #000;
border-left:1px solid #000;
border-right:1px solid #000;
color:#FFFFFF;
}
#nav li li a:hover, #nav li li a.sfhover {
background-image:url(../Images/Nav_bar_slice_over.png);
background-repeat:repeat;
color: #000;
}
Anyone see what I'm missing as to why I can't get the top level menu items to center?