CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   HTML & CSS (http://www.codingforums.com/forumdisplay.php?f=13)
-   -   push centered div to top of page? (http://www.codingforums.com/showthread.php?t=165411)

queirdo 05-04-2009 02:37 AM

push centered div to top of page?
 
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 02:52 AM

Hello queirdo,
Try changing
Code:

html, body {
    margin:0;
    padding:0;
}

to this -
Code:

* {
    margin:0;
    padding:0;
}


queirdo 05-04-2009 04: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!


All times are GMT +1. The time now is 11:17 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.