I have a very simple webpage using css. For some odd reason there is about a 20px space at the top of my page. I have no idea where this is coming from! Any ideas?

Here is the page that is causing me grief:

http://www.laudontech.com/exhibitfloorplans/test5.php5
http://www.laudontech.com/exhibitfloorplans/demomaps.css

Thanks in advance,

Mapper

Recommended Answers

All 13 Replies

body {
  text-align:center;
  font-family: Georgia, Serif;
  background: #000000;
 margin:0px;
}

i think this can help u

order is important in css
in some of the styles you set

margin-top:0;
margin:5px;

result margin-top:5px; in other styles you correctly zero the top margin

margin:5px;
margin-top:0;

a group of applied 5px will soon add to the 'missing' amount

Do not put px on a zero value. It is not supported. Put 0 instead of 0px.

make sure there are no   in your code that will create a space if in the wrong place

also make sure that the div or table you have as your header, has no margin-top pushing it down.

I followed most of the advice I found on here, and finally what worked for me was the body-top:0; I had originally used just the standard header or wrapper or whatever:0px; so hats off to you and kudos good sir.
Enjoy.
and if anyone wants to visit my humble self, feel free to wander over to

you need to set a negative margin rtfm -20px etc easy peasy

check the margin-top and padding-top of ur each style class (especially outer)... and check the heights and min-height of each div tag... google chrome inspect functionality may be helpful to solve this...

The body needs to have "margin:0;" set in the CSS to make the inner DIV's align to the top of the page.

You have to set the top-margin to a minus figure. I currently can't see a way around this issue. Everything should stay inside the DIV, especially if add "overflow: hidden;" to the CSS, but it doesn't obey this. The spacing is cause by the contents margin values. You can add a spacer element as "<p class="spacer">&nbsp;</p>" to the innder top part of your DIV and set the CSS "text-size:" as "0px;" with a "margin:0;" as well.

add default browser css reset

*{
margin:0;
padding:0;
}

Hello,

I am hoping that someone can lend a hand here with a html layout. I'm very new to site design so please forgive the sloppyness of my code

@Smeesny-

That's interesting since your signature is related to web design but OK. Please start your own thread and post your sample code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.