Hi Guys,
I am posting under here because I have been successful in centering the horizontal menu that HAVE drop downs. However, the thing I don't like that it is doing, and I'm not sure how to fix it, is that the menu shrinks then expands to add the arrows when the page is loaded. Any suggestions?
/*MENU*/
.skip-link {
display:none;
}
#access {
background-color: #000;
border: 1px solid #000000;
min-width: 940px;
max-width: 100%;
min-height: 40px;
max-height: inherit;
margin: 0 auto;
overflow:visible;
z-index:100;
}
/*** MENU POSITION ***/
.sf-menu, .sf-menu * {
margin: 0 auto;
padding: 0;
list-style: none;
}
.sf-menu {
line-height: 1.0;
}
.sf-menu ul {
position: absolute;
top: -999em;
width: 10em; /* left offset of submenus need to match (see below) */
}
.sf-menu ul li {
width: 100%;
}
.sf-menu li:hover {
visibility: inherit; /* fixes IE7 'sticky bug' */
}
.sf-menu li {
float: left;
position: relative;
}
.sf-menu a {
display: block;
position: relative;
}
.sf-menu li:hover ul,
.sf-menu li.sfHover ul {
left: 0;
top: 2.5em; /* match top ul list item height */
z-index: 99;
}
ul.sf-menu li:hover li ul,
ul.sf-menu li.sfHover li ul {
top: -999em;
}
ul.sf-menu li li:hover ul,
ul.sf-menu li li.sfHover ul {
left: 10em; /* match ul width */
top: 0;
}
ul.sf-menu li li:hover li ul,
ul.sf-menu li li.sfHover li ul {
top: -999em;
}
ul.sf-menu li li li:hover ul,
ul.sf-menu li li li.sfHover ul {
left: 10em; /* match ul width */
top: 0;
}
/*Centering Menu*/
.menu {
width: 100% !important;
text-align: center;}
.menu ul {margin:0; padding:0; list-style:none; white-space:nowrap; text-align:left;}
.menu ul {display:inline-block;}
.menu li {display:inline-block; display:inline;}
.menu ul.sf-menu div {position:absolute; left:-9999px;}
.menu ul.sf-menu {margin:0 auto;}
.menu ul.sf-menu li.sf-menu-li {float:left; display:block; position:relative;}
.menu a {display:block; text-decoration:none; padding:0;}
.menu ul.sf-menu li.sf-menu-li a.sf-menu-a {float:left;}
.menu ul li:hover div {left:50%; top:40px;}
.menu ul li:hover div ul {display:block; position:relative; left:-50%;}
.menu a:hover div {left:0; top:23px;}
.menu a:hover div ul {position:relative; left:-50%;}
.menu table {position:absolute; height:0; width:0; left:50%; border-collapse:collapse; margin-top:-4px;}
.sf-menu ul li:hover div {left:50%; top:25px;}
.sf-menu ul li:hover div ul {display:block; position:relative; left:-50%;}
.sf-menu a:hover div {left:0; top:23px;}
.sf-menu a:hover div ul {position:relative; left:-50%;}
.sf-menu table {position:absolute; height:0; width:0; left:50%; border-collapse:collapse; margin-top:-4px;}
/*** THEMATIC SKIN ***/
/* main ul element */
.sf-menu {
border-right: 1px solid #000;
}
/* general link styles*/
.sf-menu a {
display: block;
padding:9px 13px;
text-decoration:none;
border-top: 1px solid #000;
border-left: 1px solid #000;
border-bottom: 1px solid #000;
text-decoration: none;
}
/*** 1st Level ***/
/* 1st level links, no hover, no visits */
.sf-menu li a {
color: white;
background-color: black;
border-color: black;
font-family: 'Simonetta', "Palatino Linotype", "Book Antiqua", Palatino, serif; font-weight: 400;
font-size: 20px;
}
/* 1st level links, while hovering over sub menu */
.sf-menu li.sfHover a{
color: black;
background-color: #FFF587;
}
/* 1st level links, hover */
.sf-menu li a:hover {
color: black;
background-color: #FFF587;
}
/* 1st level current page */
.sf-menu .current_page_item a,
.sf-menu .current_page_ancestor a,
.sf-menu .current_page_parent a {
border-bottom-color: #000;
background-color: #FFF587;
color:#000;
}
/*** 2nd level ***/
/* sub menu */
.sf-menu ul {
border-right:1px solid;
border-bottom:1px solid;
border-color: black;
}
.sf-menu li:hover ul,
.sf-menu li.sfHover ul {
top:40px; /* overriding essential styles- adjust if you have gaps between first level and drop-down sub menu*/
}
.sf-menu ul ul {
margin-top:0; /*unlikely to need adjusting */
}
/*submenu font size*/
.sf-menu li li a {
font-family: 'Simonetta', "Palatino Linotype", "Book Antiqua", Palatino, serif; font-weight: 400;
font-size: 14px;}
/* 2nd level links, no hover */
.sf-menu li li a, .sf-menu li.sfHover li a {
color: white;
background: url(img/black_dd.png) transparent;
border-color: black;
border-bottom: 0;
}
/* 2nd level links, while hovering over sub menu */
.sf-menu li li.sfHover a{
color: black;
background: #FFF587;
}
/* 2nd level links, hover */
.sf-menu li li a:hover, .sf-menu li.sfHover li a:hover {
color: black;
background: #FFF587 url(img/pawprint_dd.png) right no-repeat;}
/* 2nd level current page */
.sf-menu li li.current_page_item a,
.sf-menu li li.current_page_ancestor a,
.sf-menu li li.current_page_parent a {
background-color: #FFF587;
color: #000;
}
/*** 3rd Level and beyond ***/
/* 3rd level links, no hover */
.sf-menu li li li a, .sf-menu li.sfHover li li a {
color: white;
background-color: black;
border-color: black;
}
/* 3rd level links, hover */
.sf-menu li li li a:hover, .sf-menu li.sfHover li li a:hover {
color: black;
background-color: #FFF587;
}
/* 3rd level current page */
.sf-menu li li li.current_page_item a,
.sf-menu li li li.current_page_ancestor a,
.sf-menu li li li.current_page_parent a {
background-color: #FFF587;
color: #000;
}
/*** arrows **/
.sf-menu a.sf-with-ul {
padding-right: 2em;
min-width: 1px; /* trigger IE7 hasLayout so spans position accurately */
}
.sf-sub-indicator {
position: absolute;
display: block;
right: .75em;
top: 1.05em; /* IE6 only */
width: 10px;
height: 10px;
text-indent: -999em;
overflow: hidden;
background: url('img/arrows.png') no-repeat -10px -100px !important; /* 8-bit indexed alpha png. IE6 gets solid image only */
}
a > .sf-sub-indicator { /* give all except IE6 the correct values */
top: .8em;
background-position: 0 -100px; /* use translucent arrow for modern browsers*/
}
/* apply hovers to modern browsers */
a:focus > .sf-sub-indicator, a:hover > .sf-sub-indicator, a:active > .sf-sub-indicator, li:hover > a > .sf-sub-indicator, li.sfHover > a > .sf-sub-indicator {
background-position: -10px -100px; /* arrow hovers for modern browsers*/
}
/* point right for anchors in subs */
.sf-menu ul .sf-sub-indicator {
background-position: -10px 0;
}
.sf-menu ul a > .sf-sub-indicator {
background-position: 0 0;
}
/* apply hovers to modern browsers */
.sf-menu ul a:focus > .sf-sub-indicator, .sf-menu ul a:hover > .sf-sub-indicator, .sf-menu ul a:active > .sf-sub-indicator, .sf-menu ul li:hover > a > .sf-sub-indicator, .sf-menu ul li.sfHover > a > .sf-sub-indicator {
background-position: -10px 0; /* arrow hovers for modern browsers*/
}
/*header clear for menu*/
#header{
clear:both;
}
This centered menu also incorporates the down pointing arrows provided by fwunder under the Thematic Menus Demystified post (page 5). The arrows were exactly what I needed since the CSS version wasn't working in all browsers. Thanks fwunder and helga for great menu tutorials help!!
You can see it here:
http://www.faeree.com/reachwp/
I appreciate any assistance you can give regarding the menu shrink/expand issue I'm having!