Forum Moderators: not2easy

Message Too Old, No Replies

Set footer at the bottom of the window?

         

tonyutada

9:35 am on Dec 5, 2006 (gmt 0)

10+ Year Member



Hi
I encountered a problem setting the div footer at the bottom of the window, not the page. Partitularly when the body content has much stuff.

I google some useful stuff from this form, but it did not work for my purpose entirely. Here is the example, the content is very long, it's just for testing.

my problem here,
If the table has many rows, the footer doesn't display at the windows bottom.
what I wannted is, if the table has many stuff, the div(contain the table) has the scrollbar, the footer is still at the bottom of the window, no matter I changed the size of the window.
Ideas are appreciated.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
html, body{height: 100%; width: 100%; border: 0; padding: 0; margin: 0; background: #fcc;}
#spacer{
display: block;
height: 95%;
width: 1px;
padding: 0;
margin: 0;
border: 0;
background: #fff; /* same as body bg */
float: right;
}

#bodycontent {
width: 100%;
margin: 0;
padding: 0;
border: 0;
float: right;
margin-right: -1px; /* this is the key to avoid the 1px jog caused by spacer */
}

#bodyarea{
margin: 0px;
background: #fcc;
padding-top: 50px;
width: 100%;
}

#leftcol{float:left; width: 20%;}
#rightcol{float:left; width: 20%;}
#centercol{float:left; width: 100%; overflow:auto;background: #ffe;}
#centercol h4{ width: 100%; background: yellow; text-align: center;}
#centercol p{padding: 10px;}

#footer{
display: block;
clear: both;
width: 100%;
padding: 0;
margin: 0;
background: #ddd;
text-align: center;
margin-right: 0px;
}

#footer p{background: #ddd;}

#header{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 50px;
background: purple;
color: white;
z-index: 50;
}

#leftmenu{
position: absolute;
top: 100px;
left: 0px;
width: 20%;
background: #ccc;
}

#rightmenu{
position: absolute;
top: 150px;
right: 0px;
width: 20%;
background: #ccc;
}

img{display: block;}

</style>
</head>
<script type='text/javascript'>
<!--
window.resizeTo(500,300);
window.moveTo(86,46);
var MainWindow=window.open('','MainS67b3418c4f4a47a99b1a79c18a8bf817');
var winMan=MainWindow.frames;
winMan.AddWindow(self);
//-->

</script>

[1][edited by: tonyutada at 10:01 am (utc) on Dec. 5, 2006]

tonyutada

9:39 am on Dec 5, 2006 (gmt 0)

10+ Year Member



the rest code of the example

<body>
<div id="spacer">
</div>
<div id="bodycontent">
<div id="bodyarea">
<div id="centercol">
<table border='0' cellpadding='0' cellspacing='0' width='1600' style='table-layout: auto;
background-color: white;'>
<tr>
<th class="GridHead" style='cursor: hand; white-space: nowrap; background-color: Silver;
width: 200px;' onclick="FireWithValue('Cd1183492b2c84ab4ba33bb7ef5ef5198','FID');">
Fid</th>
<th class="GridHead" style='cursor: hand; white-space: nowrap; background-color: Silver;
width: 200px;' onclick="FireWithValue('Cd1183492b2c84ab4ba33bb7ef5ef5198','FID_PARENT');">
fid_parent</th>
<th class="GridHead" style='cursor: hand; white-space: nowrap; background-color: Silver;
width: 200px;' onclick="FireWithValue('Cd1183492b2c84ab4ba33bb7ef5ef5198','LABEL_DEF_ID');">
label_def_id</th>
<th class="GridHead" style='cursor: hand; white-space: nowrap; background-color: Silver;
width: 200px;' onclick="FireWithValue('Cd1183492b2c84ab4ba33bb7ef5ef5198','ORIGIN');">
origin</th>
<th class="GridHead" style='cursor: hand; white-space: nowrap; background-color: Silver;
width: 200px;' onclick="FireWithValue('Cd1183492b2c84ab4ba33bb7ef5ef5198','LABEL_TEXT');">
label_text</th>
<th class="GridHead" style='cursor: hand; white-space: nowrap; background-color: Silver;
width: 200px;' onclick="FireWithValue('Cd1183492b2c84ab4ba33bb7ef5ef5198','ORIENTATION');">
Orientation</th>
<th class="GridHead" style='cursor: hand; white-space: nowrap; background-color: Silver;
width: 200px;' onclick="FireWithValue('Cd1183492b2c84ab4ba33bb7ef5ef5198','PRE');">
pre</th>
<th class="GridHead" style='cursor: hand; white-space: nowrap; background-color: Silver;
width: 200px;' onclick="FireWithValue('Cd1183492b2c84ab4ba33bb7ef5ef5198','SUF');">
suf</th>
</tr>
<tr style='cursor: default;'>
<td class="GridItem" style='white-space: nowrap;'>
<input type="text" readonly="readonly" style='width: 100%; font-family: arial; font-size: xx-small;
text-align: right; background: buttonface;' name='Cffac1160515d445699740e63565c4428'
onmousedown="mnu_Caef217bb356b4a2e89853fcbca08dd05_Show(this,event,event.button,event.clientX,event.clientY);"
value='10833' />
</td>
<td class="GridItem" style='white-space: nowrap;'>
<input type="text" ondblclick="Fire('Ccb770fde8d664c1f940d6b77dcfe333e');" readonly="readonly"
style='width: 100%; font-family: arial; font-size: xx-small; z-index: 1000;' name='C80e3912822b44d36a2be668214f66668'
value='9435' onmousedown="mnu_Cd59889502bfb4a9fb663c1a59cdc14de_Show(this,event,event.button,event.clientX,event.clientY);" />
</td>
<td class="GridItem" style='white-space: nowrap;'>
<input type="text" readonly="readonly" style='width: 100%; font-family: arial; font-size: xx-small;
text-align: right;' name='C02e88f7b00674774b76ffa8ad560aa9d' onmousedown="mnu_Caef217bb356b4a2e89853fcbca08dd05_Show(this,event,event.button,event.clientX,event.clientY);"
value='10000' />
</td>
<td class="GridItem" style='white-space: nowrap;'>
<input type="text" readonly="readonly" style='width: 100%; font-family: arial; font-size: xx-small;
text-align: right;' name='Cd4e3f6ff0bcc4844948ea836fd67ff02' onmousedown="mnu_Caef217bb356b4a2e89853fcbca08dd05_Show(this,event,event.button,event.clientX,event.clientY);"
value='8' />
</td>
<td class="GridItem" style='white-space: nowrap;'>
<input type="text" readonly="readonly" style='width: 100%; font-family: arial; font-size: xx-small;'
name='C3323ad2914f54d639ec81d132784a3d0' onmousedown="mnu_Caef217bb356b4a2e89853fcbca08dd05_Show(this,event,event.button,event.clientX,event.clientY);"
value='13A' />
</td>
<td class="GridItem" style='white-space: nowrap;'>
<input type="text" readonly="readonly" style='width: 100%; font-family: arial; font-size: xx-small;
text-align: right;' name='C8fda3c8d43484de6948473adb7963d4d' onmousedown="mnu_Caef217bb356b4a2e89853fcbca08dd05_Show(this,event,event.button,event.clientX,event.clientY);"
value='50.600' />
</td>
<td class="GridItem" style='white-space: nowrap;'>
<input type="text" readonly="readonly" style='width: 100%; font-family: arial; font-size: xx-small;'
name='C3b60778312f3432ca7881b986304da8f' onmousedown="mnu_Caef217bb356b4a2e89853fcbca08dd05_Show(this,event,event.button,event.clientX,event.clientY);"
value='' />
</td>
<td class="GridItem" style='white-space: nowrap;'>
<input type="text" readonly="readonly" style='width: 100%; font-family: arial; font-size: xx-small;'
name='C65bb45d9d63c43048973e46cc8a78bfb' onmousedown="mnu_Caef217bb356b4a2e89853fcbca08dd05_Show(this,event,event.button,event.clientX,event.clientY);"
value='' />
</td>
</tr>
<tr style='cursor: hand;' onclick="FireWithValue('C3310df6893d340e78c9e26f6cf5d1c08','2');">
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;10834</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;9436</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;10000</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;18</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;n.n.</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;45.400</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;</td>
</tr>
<tr style='cursor: hand;' onclick="FireWithValue('C3310df6893d340e78c9e26f6cf5d1c08','3');">
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;10835</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;9437</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;10000</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;18</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;22</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;45.800</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;</td>
</tr>
<tr style='cursor: hand;' onclick="FireWithValue('C3310df6893d340e78c9e26f6cf5d1c08','4');">
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;10836</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;9438</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;10000</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;8</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;6E</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;186.100</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;</td>
</tr>
<tr style='cursor: hand;' onclick="FireWithValue('C3310df6893d340e78c9e26f6cf5d1c08','5');">
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;10837</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;9439</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;10000</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;18</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;12</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;32.600</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;</td>
</tr>
<tr style='cursor: hand;' onclick="FireWithValue('C3310df6893d340e78c9e26f6cf5d1c08','6');">
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;10838</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;9440</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;10000</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;8</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;10</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;132.600</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;</td>
</tr>
<tr style='cursor: hand;' onclick="FireWithValue('C3310df6893d340e78c9e26f6cf5d1c08','7');">
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;10839</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;9441</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;10000</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;8</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;8</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;132.700</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;</td>
</tr>
<tr style='cursor: hand;' onclick="FireWithValue('C3310df6893d340e78c9e26f6cf5d1c08','8');">
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;10840</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;9442</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;10000</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;8</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;6</td>
<td class="GridItem" style='white-space: nowrap; text-align: right;'>
&nbsp;132.600</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;</td>
<td class="GridItem" style='white-space: nowrap;'>
&nbsp;</td>
</tr>
</table>
</div>
</div>
<!-- bodyarea -->
</div>
<!-- bodycontent -->
<div style="clear: both;">
</div>
<!-- to clear the floats - might not be required -->
<div id="footer">
<p>
footer text</p>
</div>
<div id="header">
Header Text</div>
</body>

tonyutada

1:46 am on Dec 6, 2006 (gmt 0)

10+ Year Member



why nobody answered this question?

Didn't I describe the problem clearly

sldesigns

11:15 pm on Dec 6, 2006 (gmt 0)

10+ Year Member



It sounds like you're looking for a fixed footer, with the content scrolling (if necessary) above it.
Not familiar with the particulars myself, but search for "css fixed positioning" or position:fixed for examples and how-tos.

tonyutada

2:18 am on Dec 7, 2006 (gmt 0)

10+ Year Member



yes, I am looking for a fixed footer in the window.
I searched the previous posts from this forum, it works for me in some way, and my demo code is derived from it.

if i set the footer div as the {position:absolute;bottom:0px} , the footer will be at the bottom of the window. But in case of I changing the window, the footer could overlap the upper content(upper div).

nigassma

6:46 pm on Dec 7, 2006 (gmt 0)

10+ Year Member



If it's overlapping you can add padding/margins to your content so that it stops at the top of the footer. Figure out the height of your footer, subtract that from the height of the content (with negative margins or something to that nature) and voila!

Here's an example creating a frames effect:

[cssplay.co.uk...]