Centering DIV elements within browser when resizing

mikerainey

New Member
I have recently seen the light and have switched from tables to DIV tags for positioning elements. I am having one problem: When I used tables, I could easily center the table in the browser (when browser is re-sized), but am unable to figure out how to center the elements within DIV tags when viewing in a browser. Any assistance would be greatly appreciated.
 

suz

New Member
In your css file you could try:

#page {
text-align: center;
}

"Page" is the div ID
Now that I read your questions again I'm not sure if I understood it correctly but anyway.
 

bcackerman

New Member
ya, this sometimes doesnt work, so what you'll want to do is this

<div style="width:___px; position:relative; margin:0px auto;>
</div>

that makes it so the div is centered no matter what browser your using. (you'll need to enter your width there)
 
Top