It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming CSS Forum

CSS Novice Seeking Navigational menu help...

CSS Novice Seeking Navigational menu help...

Postby hummy on Sat Mar 29, 2008 7:22 pm

I'm trying to work out how to get a navigational menu aligned in the center of the page, although so far i've been unsuccesful.

Please look at the following site:

www.taxrefundclaim.co.uk/testing

You will notice both navigational menu bars at the to the left as there is no margin set.
I'd like these to be in the middle of the page.

The css properties for this menu are below:

.menu
{
height:27px;
background-image:url(../images/menu_bgc1.jpg);
background-repeat:repeat-x;
width: auto;
}
.menu2
{
height:27px;
background-image:url(../images/menu_bgc1.jpg);
background-repeat:repeat-x;
width: auto;
}

Do i need to add anything else in or is a problem with the HTML i am using.

Thanks in advance.
hummy
 
Posts: 8
Joined: Fri Mar 28, 2008 1:44 pm

Postby donatello on Sat Mar 29, 2008 10:55 pm

This drives EVERYONE crazy with DIVs.

Did you try setting it inside of a Container DIV and setting the width to 100%?

There are also some javascripts out there for centering troublesome DIVs, but I have also been having fits with DIVs lately...

Then when I find out the solution, it seems so stupid and simple...

Look at the CSS on a couple of my pages where I have centered CSS menus:

http://www.thesearcheenginelist.com
http://www.howtosellyourhouse.net

I think you may find your answer in there if the container and 100% solution doesn't work.

Good luck!

I HATE DIVS!!!
User avatar
donatello
 
Posts: 4
Joined: Tue Mar 11, 2008 6:30 pm
Location: Poland

Postby hummy on Sun Mar 30, 2008 12:03 am

hi donatello.
Thanks for your reply. I'm not sure i quote understand what you mean by putting the menu inside a container DIV. I am very new to HTML and CSS and just working from someones example.

I tried adjusting the width to 100% but to no success.

If there are any other ways i would be eager to hear them.

Thanks
hummy
 
Posts: 8
Joined: Fri Mar 28, 2008 1:44 pm

Postby rangana on Tue Apr 01, 2008 5:00 am

Adjusting the width affects the width, but will never place the element in center ;)

@hummy
Try adding text-align:center;, this will place the text to the center.

If this did'nt fix the issue, add margin:0px auto;, this will place the element in the center :)

...If nothing totally works, could you please cut a code of the problem...
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines


Who is online

Users browsing this forum: No registered users and 0 guests