PDA

View Full Version : center float.



enraged
07-12-2008, 02:02 AM
Ok i'm coding a layout in expandable divs with html and css, i currently have a banner type div which is set to a 0px margin and 100% width and a main content box which also has a 0px margin, and a 550px width. I want the content box to be in the center of the page with the top touching the bottom of the banner (0px margin). So far it looks like this.
http://www.tehupload.com/uploads/app-7042652611390620.png

Now, i want the main content box centered, I could do this using the margin-left or margin-right but it would only look right in my monitor/browser; it would be out of place for everyone else.

How could i resolve this? I looked up float:center but thats not valid css.

wazup999
07-12-2008, 02:43 AM
try using


margin-left: auto;
margin-right: auto;
Waz ;]

enraged
07-12-2008, 03:56 AM
works great thanks :)
+rep

Meti
09-12-2008, 05:12 PM
Or you can do it much simplier:

margin: auto;

Want to hide these adverts? Register an account for free!