float footer below main content
-
buntrosgali
- Forum Members

- Posts: 167
- Joined: Thu Apr 17, 2008 9:02 pm
float footer below main content
I have created a site made of divs, but i forgot to create a div footer untill now, i have created the div but i want the positioning of the div to be in accordance with the length of the page its on.
for instance check out this page link
as you can see the footer is set currently at top:800; and because this page is much longer than that it is actually placed over the text.
i want to edit the code so that the footer will always go at the bottom of the page no matter how long the main content secition is.
any code helP?
footer code is
div#footer {
position:absolute;
left:11px;
top: 800px;
width:864px;
height:138px;
z-index:8;
background-color: #FF0000;
layer-background-color: #FF0000;
border: 1px none #000000;
main content code is
div#content {
position:absolute;
left:196px;
top:265px;
width:667px;
height:auotpx;
z-index:3;
background-color: #ffffff;
layer-background-color: #002A4C;
border: 1px none #000000;
min-height: 650px; /* IE wont understand these, so we will use javascript magick */
for instance check out this page link
as you can see the footer is set currently at top:800; and because this page is much longer than that it is actually placed over the text.
i want to edit the code so that the footer will always go at the bottom of the page no matter how long the main content secition is.
any code helP?
footer code is
div#footer {
position:absolute;
left:11px;
top: 800px;
width:864px;
height:138px;
z-index:8;
background-color: #FF0000;
layer-background-color: #FF0000;
border: 1px none #000000;
main content code is
div#content {
position:absolute;
left:196px;
top:265px;
width:667px;
height:auotpx;
z-index:3;
background-color: #ffffff;
layer-background-color: #002A4C;
border: 1px none #000000;
min-height: 650px; /* IE wont understand these, so we will use javascript magick */
Re: float footer below main content
position:relative; instead of absolute?
Last edited by oct4th on Fri Aug 08, 2008 2:46 am, edited 1 time in total.
Re: float footer below main content
Your problem is that you are using position:absolute all over the place on divs that just don't need it, it's only for the rare occasions where the natural flow of the template must be interrupted or something...
Except for when you need to float items they follow them selves in the order they are in the template/page, headers will be on top, then breadcrumbs, then a div to hold the 2 floats and center content, then the prev./next links div, and finally footer...
So in this case you just have to mess with floating the left and right and all else will fall in place...
Should have just hired me to do this and it would have been done long time ago, I'm cheap and ez and good...
Except for when you need to float items they follow them selves in the order they are in the template/page, headers will be on top, then breadcrumbs, then a div to hold the 2 floats and center content, then the prev./next links div, and finally footer...
So in this case you just have to mess with floating the left and right and all else will fall in place...
Should have just hired me to do this and it would have been done long time ago, I'm cheap and ez and good...
-
buntrosgali
- Forum Members

- Posts: 167
- Joined: Thu Apr 17, 2008 9:02 pm
Re: float footer below main content
would be simpler to pay someone to do it, but im want to learn how to do it myself and im getting there 
i watched a tutorial on youtube showing how to create a website in dreamweaver with divs and it said to use the position absolute thats why i have them there.
i have messed about this morning removing the absolute and trying floating each div but they were lining up ontop of each other as oppossed to falling into shape like i want it. i have reverted back to the code i had untill i get further advice from you nice ppl
would if help if i showed all the code for the stylesheet?
i watched a tutorial on youtube showing how to create a website in dreamweaver with divs and it said to use the position absolute thats why i have them there.
i have messed about this morning removing the absolute and trying floating each div but they were lining up ontop of each other as oppossed to falling into shape like i want it. i have reverted back to the code i had untill i get further advice from you nice ppl
would if help if i showed all the code for the stylesheet?
Re: float footer below main content
I use Firefox with Web Dev. extension so I see all CSS, dreamdeceiver is for ones who don't want to learn clean code, I started with notepad/hand coding and never did tables, DW just started doing div instead of tables in the last couple of years so maybe it don't know so good...
OK free lesson...
Put in this order...
main div, inside it, header div, then content div with breadcrumb/search div and right div left div then main/center div and prev./next div, then footer div...
You may want to go to themes site and get wireframe 3 col. template to study, which would work for what you are doing...
http://themes.cmsmadesimple.org/Theme_Frameworks.html
OK free lesson...
Put in this order...
main div, inside it, header div, then content div with breadcrumb/search div and right div left div then main/center div and prev./next div, then footer div...
You may want to go to themes site and get wireframe 3 col. template to study, which would work for what you are doing...
http://themes.cmsmadesimple.org/Theme_Frameworks.html
Re: float footer below main content
One of the most common layouts is a wrapper division*, then a masthead, possibly a menu bar but that's optional. Then you have floated sidebar and main content area.
Then the footer at the bottom. The trick about that is in order for the footer division to lay properly, you have to clear those floated sidebar and content divisions. You do this by adding a clearing division right before the footer and after the last floated division (whether it's the sidebar or content):
In your stylesheet:
In your template:
* Use the wrapper division to control the positioning and width of the entire layout.
Also some more advice about web design tools. Since you sprang for the costly Dreamweaver, $80USD should be a drop in the bucket, but I promise you, it's the best $80 you'll ever spend. Get TopStyle Pro by Bradsoft.
http://www.newsgator.com/Individuals/To ... fault.aspx
Use it to create your stylesheets.
And I use EditPlus2 for HTML and PHP editing.
http://www.editplus.com/
HTH
Then the footer at the bottom. The trick about that is in order for the footer division to lay properly, you have to clear those floated sidebar and content divisions. You do this by adding a clearing division right before the footer and after the last floated division (whether it's the sidebar or content):
In your stylesheet:
Code: Select all
.clearer {
margin: 0;
padding: 0;
clear: both;
}
Code: Select all
</div> [last floated division]
<div class="clearer"></div>
<div id="footer> ...
Also some more advice about web design tools. Since you sprang for the costly Dreamweaver, $80USD should be a drop in the bucket, but I promise you, it's the best $80 you'll ever spend. Get TopStyle Pro by Bradsoft.
http://www.newsgator.com/Individuals/To ... fault.aspx
Use it to create your stylesheets.
And I use EditPlus2 for HTML and PHP editing.
http://www.editplus.com/
HTH
Last edited by pixelita on Mon Aug 25, 2008 2:50 pm, edited 1 time in total.
Submit your site to the We Love CMSMS showcase
-
christiaans
- Power Poster

- Posts: 300
- Joined: Tue Mar 04, 2008 10:37 am
Re: float footer below main content
I prefer the clearfix to be honest. Clears everything properly, in every browser.pixelita wrote: One of the most common layouts is a wrapper division*, then a masthead, possibly a menu bar but that's optional. Then you have floated sidebar and main content area.
Then the footer at the bottom. The trick about that is in order for the footer division to lay properly, you have to clear those floated sidebar and content divisions. You do this by adding a clearing division right before the footer and after the last floated division (whether it's the sidebar or content):
In your stylesheet:In your template:Code: Select all
.clearer { margin: 0; padding: 0; clear: both; }* Use the wrapper division to control the positioning and width of the entire layout.Code: Select all
</div> [last floated division] <div class="clearer"></div> <div id="footer> ...
Also some more advice about web design tools. Since you sprang for the costly Dreamweaver, $80USD should be a drop in the bucket, but I promise you, it's the best $80 you'll ever spend. Get TopStyle Pro by Bradsoft.
http://www.newsgator.com/Individuals/To ... fault.aspx
Use it to create your stylesheets.
And I use EditPlus2 for HTML and PHP editing.
http://www.editplus.com/
HTH
Re: float footer below main content
Interesting! I'll have to give that a try. Thanks, Chris! Isn't this forum great? I never come here without learning SOMETHING! 
Submit your site to the We Love CMSMS showcase
-
christiaans
- Power Poster

- Posts: 300
- Joined: Tue Mar 04, 2008 10:37 am
Re: float footer below main content
That's what we are here for 

