style.css

#footer {
	height: 120px;
	width: 985px;
	float: left;
	background: yellow;
	margin-top: 190px;
	position: relative;
}

This is just a part of css code. Basically I am creating a footer underneath my web which consist of many pages. I wonder how to set its footer location since each pages has different length of content. Therefore, if I set an absolute position in a few pages the footer overlap the content.

How to set the footer then?

I use an include function for each page. I create a special page called footer.php

Recommended Answers

All 2 Replies

How about you just place the footer in it's own container below the rest of the content? It'll move down as your page height changes.

If you have a specifis footer that is inside content, place it into a relative container. The conteiner will move down, the footer will stay.

What do you mean by placing the footer in it's own container? How is it differ from the code that I writes above?

<link href="../style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {font-size: 12px}
-->
</style>

    <div id="footer">
      <p class="style1">footer</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
    </div>

That's my footer.php codes. I already set a relative position in my style.css for #footer. Yet, on a couple pages my footer overlap the page content (not footer content). I am creating a CMS website. I am placing the same footer for my whole website pages, that's why I am using an include function.

Is there any way to make when the page content are too long, the footer automatically move downward ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.