Advertisement

05.08.2008 at 12:01AM PDT, ID: 23385246 | Points: 500
[x]
Attachment Details

How to use an absolute positioned footer in combination with resizing the browser window

Tags: css scrollbar footer position absolute
Hello,

I created a simple website with a green header, a blue center and a red footer. The footer is absolute positioned at the bottom of the page. Mentioned below you can see the code for this website. I now have the following problem. If I resize the window (decrease the height) you can see move the footer up. At a certain moment a scrollbar appears. If I move the scrollbar down, then I see under the footer a blue area of the center. Besides that, if I decrease the height of the window further, the footer moves over the header, and you can't see the header anymore.

How can I change this behaviour? I want to have the footer at the bottom of the scrollable area, and not at the bottom of the viewable area.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
<style type="text/css">
HTML	
	{
	font-family:Verdana, Arial, Helvetica, sans-serif; 
	font-size:13px;
	margin:0px;
	padding:0px;
	line-height: 16px;
	color:#000000;
	height:100%;
	}
 
BODY
	{
	margin:0px;
	height:100%;
	position:absolute;	
	}
 
.header{background-color:green;
	width:500px;
	height:50px;}
 
.center{background-color:blue;
	height:150px;height:auto !important;
	min-height:150px;}
 
.footer{background-color:red;
	width:500px;
	height:100px;
	position:absolute;
	bottom:0px;
}
</style>
 
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>Test</title>
	</head>
	
	<body>
		<div>
			<div class="header"></div>
			<div class="center"><span>center</span></div>
			<div class="footer"></div>
		</div>
	</body>
</html>
Start your free trial to view this solution
Question Stats
Zone: Web Development
Question Asked By: adiemeer
Question Asked On: 05.08.2008
Participating Experts: 1
Points: 500
Views: 0
Translate:
Loading Advertisement...
05.08.2008 at 09:19AM PDT, ID: 21526085

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 12:35PM PDT, ID: 21527754

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080236-EE-VQP-29 / EE_QW_2_20070628