Advertisement

07.11.2008 at 04:32AM PDT, ID: 23556799
[x]
Attachment Details

CSS layout with dynamic height and fixed footer at bottom

Asked by DarthSonic in Cascading Style Sheets (CSS), Hypertext Markup Language (HTML)

Tags: css, firefox, ie, opera, safari

I am trying to layout a website with css. In Firefox 3 the layout is working perfectly, but not in IE7 and Opera 9.51. Did not yet try other browsers.

Maybe you can help. When calling the webpage http://www.computeruniverse.net/css/layout_test_1.htm in Firefox 3.0 you will see a perfect version of the layout with fixed footer at the bottom that will npt overlap the content but will move with the browser window (as fas as content begins).

In IE7 the footer is static positioned at the end of the content. Should be as in Firefox 3.0.

Here the code!Start Free Trial
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:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
<style type="text/css">
html 
{
	height: 100%;
	overflow-y: scroll;
}
 
body
{
	margin: 0;
	padding: 0;	
	width: 100%;
	height: 100%;
	min-width: 998px;
	background-color: white;
}
 
div.col_left { float: left; margin: 0; padding: 0; }
div.col_right { float: right; margin: 0; padding: 0; }
div.col_center { text-align: center; margin: 0; padding: 0; }
 
#cu_container
{
	position: relative;
	z-index: 0;
	margin: 0 auto;
	padding: 0;
	width: 998px;
	min-height: 100%; /* For Modern Browsers */
	height: auto !important; /* For Modern Browsers */
	height: 100%; /* For IE */
}
 
#cutop_container, #cumain_container, #cufooter_container, 
#cutop2_content, #cutop_content, #cutop2_banner, #cutop_bars, #cutop_bar1, #cutop_bar2
{
	position: relative;
	width: 998px;
	margin: 0;
	padding: 0;		
}
 
#cutop_container
{
	left: 0px; 
	top: 0px; 	
	height: 114px; 		
	z-index: 1;
}
 
#cutop2_content, #cutop2_banner
{
	height: 69px;
	background-color: red;
}
 
#cutop_content, #cutop_bars 
{
	height: 45px;
}
 
#cutop_bar1
{
	margin: 0;
	padding: 0;
	height: 21px;
	background-color: orange;
}
 
#cutop_bar2
{
	margin: 0;
	padding: 0;
	height: 24px;
	background-color: blue;
}
 
#cumain_container
{
	clear: both;
	position: absolute;
	top: 114px; /*69px Banner + 45px Menus*/
	bottom: 0 !important;*/
	bottom: -1px; /* For Certain IE widths */
	padding-bottom: 20px;
}
 
#culeft_container, #cucontent_container
{
	position: relative; 
	float: left;
	min-height: 100%; /* For Modern Browsers */
	height: auto !important; /* For Modern Browsers */
	height: 100%; /* For IE */	
}
 
#culeft_container
{
	width: 180px;
	background-color: green;
}
 
#cucontent_container
{
	position: relative;
	width: 798px; /*998px(cumain)-180px(culeft)-Margin*/
	margin-left: 20px;
	background-color: yellow;
}
 
#cufooter_container
{
	clear: both;
	position: relative;
	height: 20px;
	width: 100%;
	background-color: gray;
}
 
#cubtm_bar
{
	margin: 0;
	padding: 0;
	height: 20px;
}
</style>
</head>
<html>
<BODY topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
<div id="cu_container"> 
  <div id="cutop_container"> 
    <div id="cutop2_content"> 
      <div id="cutop2_banner"> 
        <div class="col_left">Banner1</div>
        <div class="col_right">Banner2</div>
        <div class="col_center">Banner3</div>
      </div>
    </div>
    <div id="cutop_content"> 
      <div id="cutop_bars"> 
        <div id="cutop_bar1"> 
          <div class="col_left">Links1</div>
          <div class="col_right">Links2</div>
          <div class="col_center">Links3</div>
        </div>
        <div id="cutop_bar2"> 
          <div class="col_left">Links4</div>
          <div class="col_right">Links5</div>
          <div class="col_center">Links6</div>
        </div>
      </div>
    </div>
  </div>
  <div id="cumain_container"> 
    <div id="culeft_container">
      Navigation
    </div>
    <div id="cucontent_container">
      Content
    </div>
    <div id="cufooter_container"> 
      <div id="cubtm_bar"> 
        <div class="col_left">Links7</div>
        <div class="col_right">Links8</div>
        <div class="col_center">Links9</div>
      </div>
    </div>
  </div>
</div>
</body>
</html>
[+][-]07.11.2008 at 05:11PM PDT, ID: 21986910

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Cascading Style Sheets (CSS), Hypertext Markup Language (HTML)
Tags: css, firefox, ie, opera, safari
Sign Up Now!
Solution Provided By: Kravimir
Participating Experts: 2
Solution Grade: A
 
 
[+][-]07.13.2008 at 06:09PM PDT, ID: 21995030

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628