473,396 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Creating Footers

I am having some difficulty placing a footer on my web page. I want the footer to automatically move down as more content is added. I did this by creating a relative box for the content and placing the footer below it in a relative position.

The trouble is, my content is in several relative boxes within the main box, and when I position them from the top, the main box does not expand to include them. It stays the height of the boxes it contains and does expand when they are spaced vertically. Thus, some of the content is below the boundaries of the main box and is overlapped by the footer.

How do I get the main box to extend when I change the positioning of the content? Thanks for your help. here is the code I am experimenting with and it illustrates my difficulty:

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5. <title>Untitled Document</title>
  6. <style type="text/css">
  7. <!--
  8. #main_box {
  9.     position: relative;
  10.     left: -9px;
  11.     top: -14px;
  12.     margin: 0px;
  13.     padding: 0px;
  14.     border-top-width: 0px;
  15.     border-right-width: 0px;
  16.     border-bottom-width: 0px;
  17.     border-left-width: 0px;
  18.     z-index: 1;
  19.     width: 400px;
  20. }
  21. #content {
  22.     margin: 0px;
  23.     border-top-width: 0px;
  24.     border-right-width: 0px;
  25.     border-bottom-width: 0px;
  26.     border-left-width: 0px;
  27.     position: relative;
  28.     z-index: 2;
  29.     left: 0px;
  30.     top: 100px;
  31.     padding-top: 0px;
  32.     padding-right: 0px;
  33.     padding-bottom: 0px;
  34.     padding-left: 0px;
  35.  
  36. }
  37. #footer {
  38.     position: relative;
  39.     z-index: 3;
  40.     left: -9px;
  41.     bottom: 0px;
  42.     background-color: #FF00FF;
  43.     margin: 0px;
  44.     padding: 0px;
  45.     width: 400px;
  46. }
  47. -->
  48. </style>
  49. </head>
  50.  
  51. <body>
  52. <div id="main_box">
  53. <div id="content">
  54.   <p>content content content content content content content content content content content content content content content content content content content content content content </p>
  55. </div>
  56. </div>
  57. <div id="footer">
  58. footer</div>
  59.  
  60. </body>
  61. </html>
Nov 27 '08 #1
3 2137
drhowarddrfine
7,435 Expert 4TB
Relative positioning moves the containers 'relative' to where they are but does not remove the space they occupied nor affect other elements they may cover up. iow, the 'flow' of the content will not change so the container will not change. This method may not be appropriate for what you are trying to do or maybe what you are trying to do is not going to be easy.
Nov 28 '08 #2
Thank you for your reply. I think I understand the problem better now. Do have any suggestions for a better way to place a footer that will move down as more content is added?
Nov 28 '08 #3
drhowarddrfine
7,435 Expert 4TB
What many do is wrap the content of the other elements in a <div> and place the footer outside that so as the div expands it pushes the footer down:
<div>
<element1></element1>
<element2></element2>
</div>
<footer>stuff</footer>
Nov 28 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Rupe | last post by:
Hi CSS gurus! I have an embarassing problem. I am a php programmer and I try to expound the advantages of css on the php newsgroups. However, after telling someone that they should use css...
28
by: reneecccwest | last post by:
hello, how can I remove IE headers and footers when I print a page? I'd like to use a code to remove them, not thru the IE page setup. s/RC
1
by: Kenneth | last post by:
Hi, In IE6 you can configure output to the printer getting a clean printout only with content, but without headers and footers. You remove the Header and Footer content from the Page Setup. But...
7
by: Robert Adkison | last post by:
I need to print a web page. It is my preference that my users just do a File/Print from explorer. That way my users will get the print dialog that will allow them to select the fax printer. The...
3
by: E.Doxtator | last post by:
Hi All I've been using the pyRTF module to generate some documents that I need for work. In general, the module is good, and pretty simple to use. However, I am running into a problem with...
4
by: Coleen | last post by:
Hi All :-) I'm not sure where to post this, but my organization is looking for a good software application that is not terribly expensive that allows you to create documentationand help files and...
0
by: steve | last post by:
I am looking for a way to create dynamic headers and footers in a web form. There are .Net PDF products that convert web form content into PDF format and insert dynamic headers/footers. I'm...
3
by: Brett Barry: Go Get Geek! | last post by:
Hello, I just started using Access 2007 after using Access 2003 for a long time. I've created all my queries and they work fine. However, either I forgot or it has changed but, how do I create a...
4
by: ppuniversal | last post by:
Hi, I am developing an application in ASP .NET where I have to generate a Header and a Footer on my web pages. The issue is that, these headers and footers need to be dynamically placed on the page....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.