Adding footer w/ CSS

He has: 69 posts

Joined: Oct 2003

ok i'm trying to get my webpage i'm working on to have a footer... if there is not enough content to fill the page vertically, the footer sits at the bottom of the window. If there is enough content to fill the page and make it scroll, the footer immediately follows the end of the content as it would in a normal flow. I know it can be done in CSS, but I don't know how to use CSS, or the first thing about it really.

I want to make it so this image as the footer.

this is the website i'm working on: http://www.thepackage.org/i/
this how i want it, but w/ the image at the bottom instead of where it is: http://www.thepackage.org/i/ex.php

Please help me!!
I found this: http://scott.sauyet.com/CSS/Demo/FooterDemo1.html
which i got from http://css-discuss.incutio.com/?page=FooterInfo

but i don't understand how to do it still.

Busy's picture

He has: 6,151 posts

Joined: May 2001

use the .css sheet the demo gives you, replace the background-color: #ccffcc; with the CSS background image code.

The best way to learn is to try and fail, is way better than getting it first time or other people doing it for you. when you fail you learn from your mistakes, when you fluke it you learn nothing.

Try work it out, if you can't no worries just post back here with some code and we can show you where you've gone wrong.

Everyday is a learning day Smiling
** I learnt today that you shouldn't just rip the space bar key out of your keyboard to clean it when you spill something on it - it breaks the tabs and becomes only usable from the center of the key - DOH**

[an after thought]
In this case your probably better off using tables for this, your trying to force the footer to the bottom of the page without content, so pages with little to no content will be very blank and look unfinished. I can only see your site with 800x600 but on big screens it must look empty.
This is just an opinion, but I'd do it something like:

top section

left side - left background set in td
content section
right side - right background set in td

footer section

This way the page will expand and contact to your content height and the side images being backgrounds will go with it. instead of using background= you could use CSS until you got the nack of CSS (style="...." or class="...")
downfall to this basic method is if the page is really long, in this case we place the image in the left and right td cells (valign="top") and just use a pipe type background on each side. This method is reallly simple yet fools so many people - they ponder "how did he do that?"
[end after thought]

He has: 69 posts

Joined: Oct 2003

Ok, i tried that code they gave and I can't get it to work. I just made a css.css, pasted that code in there, and changed the bg color to background url.

here is my stylesheet page http://www.thepackage.org/i/css.css
here is a link to the page again: http://www.thepackage.org/i/

i don't think i can use tables b/c the tables on the sides would have to be taller than the content box in the middle.

Busy's picture

He has: 6,151 posts

Joined: May 2001

you have declared your footer in your .css file but not on the actual page.

you need something like .... above the

He has: 69 posts

Joined: Oct 2003

well, didn't work. i guess i will either not have a footer or need to reslice my layout so that I can do this in effect w/ tables. Unless you got any other ideas.

Busy's picture

He has: 6,151 posts

Joined: May 2001

you have you need as a minimum

you could also put the id="footer" into a td cell if wanted. probably perfered as you have a set width table and aligning the footer image (HTML vs CSS) could be tricky in larger screen sizes.

In CSS #footer and .footer mean two different things.
a # indicates an id - can be used only once
a . indicates a class - can be used over again

in HTML #footer is a link anchor (link within section of a page) go to the footer .....

He has: 69 posts

Joined: Oct 2003

Busy wrote: you have you need as a minimum

you could also put the id="footer" into a td cell if wanted. probably perfered as you have a set width table and aligning the footer image (HTML vs CSS) could be tricky in larger screen sizes.

In CSS #footer and .footer mean two different things.
a # indicates an id - can be used only once
a . indicates a class - can be used over again

in HTML #footer is a link anchor (link within section of a page) go to the footer .....

I tried just id="footer" first. i haven't tried putting id=footer into a td cell yet.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.