tags:

views:

49

answers:

3

Im developing a website and in my page, after every HTML elements ends, their is an extra vertical height as I scroll down. It makes my page look bad. I want the scrolling to go as far as the last div I've written. Is there something I can do to fix it??

Edit:

Here's the link http://pebam.info/projects/careermanipur.com/ I tried checking out using firebug but I can't figure it out.

At the footer section, I want the vertical white space gone so that the page ends with the grey part.

+1  A: 

It could be the default margin on the body tag, you can zero that out with this style:

body { margin:0px; padding:0px; }

Can you post a link to the site so I can inspect?

One other possibility is that some elements will cause trailing whitespace if there is whitespace in your code.

So look for places where you have this:

<div>
 <a href="#foo">some random link</a>
</div>

And convert to (for the purposes of identifying the problem, you can re-format/indent later when you identify where the problem is):

<div><a href="#foo">somerandomlink</a></div>

Also make sure you dont have any self-closing divs

Additionally, what DOCTYPE are you using?

David
well, it's in localhost so i can't show u the live site. I tried putting that line body { margin:0px; padding:0px; } but still the same.
ptamzz
I've used a webdeveloper tool and saw the divs, elements etc outlines but none goes that far down... what I meant to say is, I don't think I've declared some invisible custom height for an HTML element.
ptamzz
Additionally I would try zeroing out the `DIV` AND using FireBug for firefox to see your CSS / properties at run time.
Jakub
i'll try using firebug. Im using <!DOCTYPE html>
ptamzz
Best bet at this point is upload the site somewhere you can provide a link so that we can inspect and help more.
David
I've uploaded and posted the link above. Kindly check it.
ptamzz
Looks like you got your solution before I had a chance to inspect after you posted. Happy to see it was identified.
David
Thanks for you help :)
ptamzz
+1  A: 

Without knowing the source code, I'm just going to tell you all the generic responses and hopefully one will work for you.

<DOCTYPE html> Declare your page with a doctype

body {margin:0; padding:0;} Reset margin/padding on all elements

p {line-height:1.1em;} The trailing white space might be the line-height of your elements?

If none of these suggestions work, download Mozilla Firefox web browser, install Firebug add-on, open it inside your web page, and use the inspect element (ctrl+shift+c) feature to inspect the problem elements. Once you click on an element you can view its style, layout, and computed values from Firebug. This is almost guaranteed to show you where the error is.

Moses
+2  A: 

Your footer tag has a top:-50px on it. This is where the white space at the bottom is coming from -- The box is being moved up 50 pixels, but the space for it is being kept.

You need to re-work your layout to remove the way you're shifting everything up by 50 pixels.

Spudley