Jump to content

newbie: How do you horizontally center (align) a div ?


amakeler

Recommended Posts

Hi all, Subject: newbie q: How do you horizontally center (align) a div ?I have looked thru all the CSS commands, but for some reason I could not seem to find a command to horizontally center (align) a <div>. I have taken somebody's good advice to put all my content in some sort of #content div, but now I have decided to make the content a certain width, say 900px, I can't find a way to center the #content div in the center of the browser window.So surely there must such a command? Thinking...or maybe not, coz every time somebody widens the browser the whole content will have to jump.Anyway...need help.avraham

Link to comment
Share on other sites

you shouldn't need the text align attribute for the body.As saying text-sling:left; in every other element means extra bytes to d/l from the css, a bit useless in my opinion, And it says on that site that its for ie5 for windows. Who the heck uses ie5 nowadays? :)

Link to comment
Share on other sites

you shouldn't need the text align attribute for the body.As saying text-sling:left; in every other element means extra bytes to d/l from the css, a bit useless in my opinion, And it says on that site that its for ie5 for windows. Who the heck uses ie5 nowadays? :)
Yeah since IE7 came out I've completely disregarded support for ie5.By the way, if you're being so nitpicky about extra bytes....
#content
#id{margin: 0px auto;width:900px;}

can be
#id{margin: 0 auto;width:900px;}

:)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...