Jump to content

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


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 post
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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...