Log in

View Full Version : How to center this CSS



Dirt_Diver
10-21-2008, 05:45 PM
I have decided to change my CSS from an older type to this new version of frustration...

Can someone help me center the nav bar on my page?
www.josephsalmi.com

right now I have this code to put it where I want it but that is only on this screen. I would like to center the navbar on every computer screen.

.mynavbarmenu{
font: bold 12px Verdana;
border-bottom: 1px solid black;
position: absolute;
z-index:100;
padding-left: 331px; /*offset of tabs relative to browser left edge*/
}

Dirt_Diver
10-21-2008, 11:13 PM
Just thought I might add that I am using the jQuery Multi Level CSS Menu #1 code from here:
http://www.dynamicdrive.com/style/csslibrary/item/jquery_multi_level_css_menu_horizontal_blue/

Medyman
10-21-2008, 11:46 PM
Set a width and then use margin:auto;

Dirt_Diver
10-22-2008, 12:05 AM
Okay this is what I have now and nothing happend



.mynavbarmenu{
font: bold 12px Verdana;
border-bottom: 1px solid black;
position: absolute;
width: 610px;
margin: auto;
}

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

/*Top level list items*/
.mynavbarmenu ul li{
position: relative;
display: inline;
float: left;
}

TheJoshMan
10-22-2008, 02:46 AM
use position RELATIVE and margin 0 auto...

like this:



.mynavbarmenu {
-x-system-font:none;
border-bottom:1px solid black;
font-family:Verdana;
font-size:12px;
font-size-adjust:none;
font-stretch:normal;
font-style:normal;
font-variant:normal;
font-weight:bold;
line-height:normal;
margin:0 auto;
position:relative;
width:610px;

Dirt_Diver
10-22-2008, 11:58 AM
SWEET!!!!!!!!!!! that works for IE and FF. Awesome fix. Thanks...

TheJoshMan
10-22-2008, 12:04 PM
no problem, glad to help