Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
|
That's precisely WHY it won't work. margin: 0px auto; will only fill in the remaining left and right margins AFTER the width of the div has been calculated.
If your div width is 100%, then there's no more margin to fill on either side since your div is filling up the whole page anyway.
In other words, you need to specify a div width that isn't 100%. The syntax does work and work well (see these sites for two working examples: http://www.lightenupontario.ca and http://www.greenbuildingfest.com ). If you want your div to span the width of the page AND be centered...that's simply not going to work.
In other words, you need to rethink your math.
|