tags:

views:

53

answers:

4

I'm building a webpage which has an 'img' floated within a div as the lowest element displayed on page. The page ends abruptly at the bottom of the image. For nice aesthetics I would like the user to be able to scroll to just beyond the image (20px or so). I have attempted to apply margin-bottom and padding-bottom to both the body, a containing div, and the image in question but to no avail.

I have not, and will not try to do this using html to add a buffer or any other hackish solution.

The page: http://www.roughgiraffed.com/about.php (please don't judge us lol, still very rough (pun intended) and far from deployment)

Thank you in advance for any help!

A: 

I did the following as a test and that makes the body overflow and show a vertical scrollbar. Try it.

<html>
<body>
   <div id="container">
      <div id="imageContainer" style="padding-bottom:1000px;">
         <img src="youImage.jpg"/>
      </div>
   </div>
</body>

Also, the following is a slightly different approach:

<html style="height: 110%;">
<body>
   <div id="container">
      <div id="imageContainer">
         <img src="youImage.jpg"/>
      </div>
   </div>
</body>​​​
Strelok
Thank you for the effort, but the first approach is similar to what I have been trying (it fails in my case) and the second doesnt really apply to my case.
Zach Lysobey
A: 

Perhaps you styled THE element with display:inline?

Inline elements can't have padding or margins

Norbert de Langen
+2  A: 

Try adding overflow: hidden; on #container. The floats are taking the .profile divs out of the flow of the document, which makes the browser think #container is only as high as the general text. Setting an overflow somehow resets this. When you've added it, you can set a margin on the container as you normally would.

Jouke van der Maas
Brilliant! This tip worked like a charm. Not really sure why it works, but this was just what I needed.
Zach Lysobey
I don't either. I stumbled into it once after ages of going trough useless samples. I'll never forget it and try to share it as much as possible to save others from that.
Jouke van der Maas
A: 

You should be able to add margin-bottom to your body tag.

body { margin-bottom: 20px; }

Otherwise you can ad that margin-bottom to your container

<div id="container"> 
   <img src="yourimage.jpg" alt="" />
</div>

#container { margin-bottom: 20px; }

NOTE: both methods worked when tested

s_broderick
yup thats what I tried to do; problem was related to a floated image as the lowest element on the page I think. I am updating the original question to reflect this.
Zach Lysobey