View Full Version : Javascript Menu

05-16-2008, 07:32 PM
Im having trouble with my javascript horizontal menu and getting it to center within a browser.

here is my stylesheet:

.horizontalcssmenu ul{
margin: 0;
padding: 0;
list-style-type: none;

/*Top level list items*/
.horizontalcssmenu ul li{


/*Top level menu link items style*/
.horizontalcssmenu ul li a{
display: block;
width: 75px; /*Width of top level menu link items*/
padding: 2px 8px;
border: 1px solid #202020;
border-left-width: 0;
background: url(menubg.gif) center center repeat-x;
color: black;
font: bold 13px Tahoma;

/*Sub level menu*/
.horizontalcssmenu ul li ul{
left: 0;
top: 0;
border-top: 1px solid #202020;
position: absolute;
display: block;
visibility: hidden;
z-index: 100;

/*Sub level menu list items*/
.horizontalcssmenu ul li ul li{
display: inline;
float: none;

/* Sub level menu links style */
.horizontalcssmenu ul li ul li a{
width: 160px; /*width of sub menu levels*/
font-weight: normal;
padding: 2px 5px;
background: #e3f1bd;
border-width: 0 1px 1px 1px;

.horizontalcssmenu ul li a:hover{
background: url(menubgover.gif) center center repeat-x;

.horizontalcssmenu ul li ul li a:hover{
background: #cde686;

.horizontalcssmenu .arrowdiv{
position: absolute;
right: 0;
background: transparent url(menuarrow.gif) no-repeat center left;

* html p#iepara{ /*For a paragraph (if any) that immediately follows menu, add 1em top spacing between the two in IE*/
padding-top: 1em;

/* Holly Hack for IE \*/
* html .horizontalcssmenu ul li { float:none; height: 1%; }
* html .horizontalcssmenu ul li a { height: 1%; }
/* End */

It wont center when I use the align attribute through the div tag as well.

here is my menu in html:

<div class="horizontalcssmenu" align="center">
<ul id="cssmenu1">
<li style="border-left: 1px solid #202020;"><a href="2008.htm">2008</a></li>
<li><a href="2007.htm">2007</a></li>
<li><a href="2006.htm">2006</a></li>
<li><a href="2005.htm">2005</a></li>
<li><a href="2004.htm">2004</a></li>
<li><a href="2003.htm">2003</a></li>
<li><a href="2002.htm">2002</a></li>
<li><a href="2001.htm">2001</a></li>
<li><a href="2000.htm">2000</a></li>
<li><a href="1999.htm">1999</a></li>
<li><a href="1998.htm">1998</a></li>
<li><a href="1997.htm">1997</a></li>
<li><a href="1996.htm">1996</a></li>
<li><a href="1995.htm">1995</a></li>
<li><a href="1994.htm">1994</a></li>
<li><a href="1993.htm">1993</a></li>
<li><a href="1992.htm">1992</a></li>
<li><a href="1991.htm">1991</a></li>
<li><a href="1990.htm">1990</a></li>
<li><a href="1989.htm">1989</a></li>
<li><a href="1988.htm">1988</a></li>
<li><a href="1987.htm">1987</a></li>
<br style="clear: left;" />

Any suggestions?

05-16-2008, 09:25 PM
Where is the javascript? Is this a DD menu? Please post a link to the demo page where you got the code for this menu. Please post a link to the page on your site that exhibits the problem.

05-19-2008, 02:01 PM
I just posted it up on angelfire because it was free and easy... Any suggestions to center the menu?


05-19-2008, 08:07 PM
I just realized that this should be in the CSS portion of the forums... sorry!