Click to See Complete Forum and Search --> : [RESOLVED] centering a div (not the text in it)


Wiz Creations
06-29-2006, 11:07 PM
I'm not sure if I've done it before, but (if there is a way) what is the css to center a div tag. I can't remember how to do it.

This just made the text center:
#content {
text-align:center;
border:5px #000066 ridge;
background-color:#93DCFF;
padding:7px;
width:575px;
height:auto;
}
This code caused what is seen in the attached image (http://www.webdeveloper.com/forum/attachment.php?attachmentid=7151&stc=1):
<div id="content" align="center">
I don't want to use <center><div>...stuff...</div></center>

here is the page:
http://wizcreations.com/newsite/

Kravvitz
06-29-2006, 11:49 PM
Four ways to Center Elements with CSS (in IE5+/Win and other browsers) (http://www.dynamicsitesolutions.com/css/center_element/)

Wiz Creations
06-29-2006, 11:53 PM
i got it by adding margin:0px auto; to both the body and #content items in the css.