PDA

View Full Version : Quick Centering Question



katie_lostsoul
Mar 27th, 2007, 09:27 PM
Hello!

I am having difficulty getting my menu to center. You can download the files at: http://www.tombraiders.net/katie/css.zip

Thanks! :)

twodayslate
Mar 27th, 2007, 09:35 PM
margin: 0 auto;

If that does not work you might need to do text-align: center;

katie_lostsoul
Mar 27th, 2007, 09:40 PM
Unforunately that doesn't work....and I already have text: align for the text within the tabs :(

twodayslate
Mar 27th, 2007, 09:42 PM
I am not going to download your code so I am sorta guessing what the problem is.

Use text-align: center; on the container that hold the menu (center the entire site) and then text-align: left; on the container that holds the content and everything should be good. (resets so it just centers menu)

You want the menu to be centered correct? Or do you just want the stuff in the menu?

http://www.w3.org/Style/Examples/007/center.html

katie_lostsoul
Mar 27th, 2007, 09:47 PM
Everything is already centered on the tabs, I need to center the entire menu on the page. Looking at the code might help :)

koyama
Mar 27th, 2007, 11:20 PM
Are you aware that you are using an incomplete doctype that is triggering quirks mode (http://www.quirksmode.org/css/quirksmode.html) in both Firefox and IE? Therefore the correct way of centering block-level elements using margin: 0 auto is not working in IE

You have this:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

Instead this one may be suitable:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

Go here to learn more about what doctypes trigger which modes: Activating the Right Layout Mode Using the Doctype Declaration (http://hsivonen.iki.fi/doctype/)

katie_lostsoul
Mar 27th, 2007, 11:21 PM
Wow that just screwed up everything in the browser....:S

jlhaslip
Mar 28th, 2007, 04:48 AM
Trust us on this one.
It is easier in the long-term to have the correct DTD and hack for non-compliant Browsers than to attempt to have the standard compliant Browsers display the page against the Standards (incorrectly).
Does that make any sense?

twodayslate
Mar 28th, 2007, 05:50 AM
Trust me, you want to have a valid page and a doctype will help you with that.

_Aerospace_Eng_
Mar 28th, 2007, 07:46 AM
Everything is already centered on the tabs, I need to center the entire menu on the page. Looking at the code might help :)

No you putting the page online somewhere might help. Having us reconstruct your page isn't the thing we do. Help us help you. You are the one asking for help not us.