/    Sign up×
Community /Pin to ProfileBookmark

Problem with CSS footer

Hello,

I have a problem with CSS footer on my page.
See my base code below. If I set the footercontainer position:relative than it works if the centercontent is big enough. If I set it to absolute than it works if the centercontent is small.
How can I put the footer always at the end of the page?

Thanks for your help!

[code]
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “DTD/xhtml1-transitional.dtd”>
<html>
<head>
<title>Test</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>

<style type=”text/css”>

#bannercontainer {
width:901px;
height:100px;
background:#fff ;
border-bottom:1px solid #000;
border-right:1px solid #aaa;
}

#maincontainer {
width:901px;
background:#fff;
}

#banner {
background:#147;
width:800px;
height:100px;
float:left;
}

#leftcontainer {
position: absolute;
left:0;
top:101;
width:125;
background:#eee;
}

#centercontent {
background:#fff;
margin-left: 127px;
margin-right:127px;
margin-top:0px;
padding-left:10px;
padding-right:10px;
padding-top:20px;
width:650px;
}

#footercontainer {
position:relative;
bottom: 0px;
width:901px;
height:15px;
background:#567;
color: #ddd;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
text-align: center;
font-weight: normal;
padding-top: 5px;
margin-top:50px;
}

body {margin:0px 0px 0px 0px; padding:0px; }
.menu {background-color:#eee; border-right:1px solid #aaa; border-bottom:1px solid #aaa; padding-top:20px; }
.menu a { width:120px; height:20px; line-height:20px; background-color:#eee; display:block; color:#000; }
.stat { width:125px; height:120px; background-color:#eee; }
.login { width:125px; height:180px; background-color:#eee; }

</style>

</head>
<body>

<div id=”bannercontainer”>
<div id=”banner”></div>
</div>

<div id=”maincontainer”>

<div id=”leftcontainer”>
<div class=”menu”>
<a id=”top” href=”index.php”>Home</a>
<a href=”demo.php”>demo</a>
<a href=”demo.php”>demo</a>
<a href=”demo.php”>demo</a>
</div>

<div class=”stat”>
<p>USER:&nbsp;&nbsp; </p>
<p>USER:&nbsp;&nbsp; </p>
<p>USER:&nbsp;&nbsp; </p>
</div>
<div class=”login”>login</div>
</div>
<div id=”centercontent”>
<table>
<tr><td><br>Generated by PHP<br></td></tr>
<tr><td><br>Generated by PHP<br></td></tr>
<tr><td><br>Generated by PHP<br></td></tr>
<tr><td><br>Generated by PHP<br></td></tr>
</table>
</div>

<div id=”footercontainer”>Demo footer</div>

<?php

?>
[/code]

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@FangAug 26.2005 — Can you give the complete document; there is a bit missing at the bottom.
Copy linkTweet thisAlerts:
@RockhoundAug 26.2005 — I always use a clearing tag for my footer..

basically

#clearing { clear: both; }

that clears all divisions basically and places that portion after the last division tag, unless of course you use a wrapper which it seems you do not.

Just place that division above the footer div and it should work.

Hope that helps,

J
×

Success!

Help @elmu spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...