PDA

View Full Version : push centered div to top of page?



queirdo
05-04-2009, 03:37 AM
Here is what I have so far:
http://queirdo.com/index2.htm

I just want to center the #content div and have it at the top of the page. I can center it with margin:0, but then on every browser tested (except IE of course because it always does it's own thing) there is a gap between the div and the top of the page. If I try to absolute position it to top:0px it will no longer be centered.

How can I fix this?

(Why I am using this layout: I have background images that I want to extend on both sides on larger resolutions, but they won't fit on the page with content on 800X600 resolution, so I just want them to disappear when the window is that small. They need to match up exactly with an image I will put in the #content div, so I need it to be in the same place on every browser. I've tried a bunch of other ways to accomplish what I want, but nothing has worked so I'm trying 2 divs underneath the main content to put my background images in, extending from the center.)

Excavator
05-04-2009, 03:52 AM
Hello queirdo,
Try changing
html, body {
margin:0;
padding:0;
}
to this -
* {
margin:0;
padding:0;
}

queirdo
05-04-2009, 05:27 AM
Yes, that works. It turned out it was the margin or padding on the paragraph inside the div that was shifting things down. Thanks!