Forum Moderators: not2easy

Message Too Old, No Replies

Div on absolute bottom

         

reform

7:28 pm on Oct 29, 2004 (gmt 0)

10+ Year Member



I canīt get my div to the absolute bottom, it is a couple of pixels above, can someone explain why?
CSS:

<style type="text/css">
body {
margin:0;
padding:0;
background: url(bg.gif);
color:#000;
min-width:750px;
height: 100%;
}
div#wrap {
background:url(mainbg.gif);
margin:0 auto;
width:750px;
height: 100%;
}
#header {
background-color:#ddd;
margin-left: 5px;
margin-right: 5px;
}
#nav {
background-color:#c99;
margin-left: 5px;
margin-right: 5px;
}
#nav ul{
margin:0;
padding:0;
}
#nav li{
display:inline;
list-style:none;
margin:0;
padding:0;
}
#main {
float: left;
width: 485px;
margin-left: 5px;
margin-right: 5px;
}
#sidebar {
width:242px;
margin-left:495px;
}
#wrap > #sidebar {
width:245px;
}
#footer {
background-color:#cc9;
clear:both;
}
#imageholder {
background-color: #FFFFFF
width: 245px;
position: absolute;
bottom: 0;
}
</style>

HTML:


<body>
<div id="wrap">
<div id="header"><h1>Whatīs up?!</h1></div>
<div id="nav">
<ul>
<li><a href="#">Option</a></li>
</ul>
</div>
<div id="main">
<h2>Column 1</h2>
</div>
<div id="sidebar">
<h3>Column 2</h3>
<ul>
<li><a href="#">Link</a></li>
</ul>
</div>
<div id="imageholder">
<IMG SRC="lol.gif">
</div>
</div>
</body>

photon

12:34 am on Oct 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try setting
padding:0;
on div#wrap.

reform

8:32 am on Oct 30, 2004 (gmt 0)

10+ Year Member



That came out even worse.

stever

8:42 am on Oct 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try:

<div id="imageholder">
<IMG SRC="lol.gif"></div>

instead of

<div id="imageholder">
<IMG SRC="lol.gif">
</div>

(trust me!)

reform

9:32 am on Oct 30, 2004 (gmt 0)

10+ Year Member



<div id="imageholder">
<IMG SRC="lol.gif"></div>

Gave the same result as padding: 0; on #wrap

<div id="imageholder"><IMG SRC="lol.gif"></div>

almost did the trick, 1 or 2 more pixels to go down.

I really donīt seem to understand how these things work :_(

stever

9:58 am on Oct 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try putting visible colored borders on the image and on the imageholder div. This is to see if the div is touching the bottom... or if it is the image which is affected.

reform

2:00 pm on Oct 30, 2004 (gmt 0)

10+ Year Member



When I put a 1px border on the div itīs 1px from the bottom.

stever

3:03 pm on Oct 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



html{
height: 100%;
}

as well?

reform

3:14 pm on Oct 30, 2004 (gmt 0)

10+ Year Member



That came out like padding: 0; on wrap.

vinzzz

5:14 pm on Oct 30, 2004 (gmt 0)

10+ Year Member



are u testing it in IE or what? IE has this little 1px calculating bug...

Hanu

5:37 pm on Oct 30, 2004 (gmt 0)

10+ Year Member



</div><div id="imageholder"><IMG SRC="lol.gif"></div></div>

That's stever's solution taken one step further. Fixed the gap for me in IE 6.0 SP1. FF displays it correctly with and without the newlines.

Background: A newline in the html is equivalent to a space character. Your div is of fixed width so the space character wraps to the next line and creates the vertical gap. These hidden whitespace bugs can easily be identified by changing the font size. If the gap changes with font size, it's a hidden whitespace.

Another way to fix it is adding this style:

#imageholder img { display: block; }

Then you can leave the newlines in the HTML.

stever

5:47 pm on Oct 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmasterworld, reform, by the way - rude of us not to mention it before now....

reform

5:16 pm on Oct 31, 2004 (gmt 0)

10+ Year Member



Thanks :)

Iīm using IE 6.0.2 SP2.
#imageholder img { display: block; } didnīt do the trick either iīm afraid.

Hanu

8:34 pm on Oct 31, 2004 (gmt 0)

10+ Year Member



I copy-and-pasted your code into an html file and both of the solutions work for me. Otherwise I wouldn't have posted them. Do you do the tests on the sample code that you posted or on something else? Is your page in quirks or standards mode?