position: absolute ist schon der richtige Weg
inkl. Hack für den IE < 7
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Footer</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="generator" content="Geany 0.16" />
<style type="text/css" media="all">
* {
margin: 0;
padding: 0;
}
html {
height: 100%;
}
body {
height: 100%;
}
#main {
position: relative;
width: 100%;
min-height: 100%;
}
#head {
height: 150px;
background: red;
}
#menu {
height: 50px;
margin-top: 15px;
background: yellow;
}
#content {
margin-top: 15px;
padding: 0 15px;
height: 1000px;
}
#footer {
position: absolute;
width: 100%;
bottom: 0px;
margin-top: 15px;
background: #ccc;
}
</style>
<!--[if lt IE 7]>
<style type="text/css">
#main {
height: 100%;
}
</style>
<![endif]-->
</head>
<body>
<div id="main">
<div id="head">
<h1>Header</h1>
</div>
<div id="menu">
<h2>Menu</h2>
</div>
<div id="content">
<h2>Content</h2>
<p>Lorem Ipsum</p>
<p>Lorem Ipsum</p>
<p>Lorem Ipsum</p>
</div>
<div id="footer">
<h3>Footer</h3>
</div>
</div>
</body>
</html>
Alles anzeigen
Wenn du davon was nicht verstehst => nachfragen.
Gruß,
jojo