views:

189

answers:

3

Hello there.

I'm trying to put an x-repeat "grid" of images by using background-image in CSS, then using the id in a DIV tag. My intention is to put a sort of "panel", then always extends to the very top of the page, and loops with repeat-x. It works just fine without a DOCTYPE, but when I put the clean in the code, it pushes the image in the tag downwards, as if there's a margin on the top of the page of about 15 px or so. I tried top-margin, z-index, with no success.

Excuse me if I'm asking a silly question, but I'm sort of new.

Thanks, -Jacob

A: 

A doctype is required of all modern web pages. This sounds like you are fighting the box model when you don't have one. Without a doctype, you are in quirks mode, and all hell breaks loose.

Rob
+1  A: 

Hi Jacob!

It's a bit unclear from your description exactly which method you use for putting your panel at the top of your page, but it seems to me that your panel div is placed at the very top of the body element in yoor HTML code like this:

    <body>
          <div id="yourid">
[...]
          </div>

and if that is the case, you're probably suffering from the default settings for margin and/or padding for the body and/or html elements in your browser (and how they might differ between browser modes - ie. with or without the doctype - in some browsers).

The default settings for these vary between browsers - and a common way to work around that problem is to reset them - for example like this:

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

If this doesn't help you, please supply some more details (ie. code or a link to the affected page)

Jarvklo
A: 

If a browser is operating in standards-mode (which you want, and which is triggered by having a good doctype), then the <body> element has some margin or padding on it. Use body { margin:0; padding:0; } to clear it out and have your elements fill the entire screen.

Xanthir