tags:

views:

132

answers:

4

I am beating my head against a wall trying to figure out why the code I have written for a particular site doesn't quite work.

The main body of my pages (the white area in link below) should be stretching from navigation to the footer but only does so on certain pages.

The footer is automatically placed at the bottom of every page regardless of height (i.e. will be at page bottom on a 400px height page).

Is it possible I am just missing something very basic?

I have posted a link to the dev version of the site at:

www.contendertest.com

The pages I am having trouble with are index and the 'enroll' link.

+1  A: 

It's because there is not enough content to fill it all the way out if you have a large viewing area. If you look on a monitor with a larger window, you can see that it is not white all the way to the footer.

EDIT: add the line padding-bottom:100px to #bodyContainer and margin-top:-100px to #footer and it will work.

Catfish
@Catfish - I'd normally downvote an answer like this given that is the obvious "answer" with no solution and hence my question in the first place. There are several ways to manipulate CSS (e.g. how my footer sticks to the bottom of every page regardless of height)
JM4
I've edited my answer. Please try it now.
Catfish
Actually all you need is to add padding-bottom to the #bodyContainer.
Catfish
That doesn't work good either...FML
Catfish
The edited answer works for me and I like it better than my own answer. Sticky Footers are hard! (Let's go shopping!)
Doug
@Doug - while that solution will work on the homepage, it will not on the Enroll page.
JM4
note - it also creates an unnecessary vertical scroll unfortunately
JM4
@Catfish - I apologize, it does still have issues with the enroll page but almost unnoticeable. I thank you for your solution and help!
JM4
@catfish - I did not have your code utilized on my contact page which uses a background image which must be attached to the bottom, unfotunately this causes the suggestion to fail. Any ideas?
JM4
I don't think i'm following you. I just checked your link again and I don't see what the problem is.
Catfish
I think i see it. The boxer is supposed to be down further. Just add a margin-bottom: -40px to the element that has the boxer image.
Catfish
A: 

style.css, line 16, remove height:100%

now

html, body {
  background-color:#EDEDE1;
  color:#666666;
  font:12px Helvetica,Arial,sans-serif;
  height:100%;
  margin:0;
  padding:0;
  text-align:justify;
}

after

html, body {
  background-color:#EDEDE1;
  color:#666666;
  font:12px Helvetica,Arial,sans-serif;
  margin:0;
  padding:0;
  text-align:justify;
}
el_quick
@el_quick - thanks for the suggestion but i tried that before and it did not work. Removing that line simply brings the footer up tight with the rest of the page (I uploaded the most recent CSS to my site to show what I mean). Unless the page scrolls down, the footer should ALWAYS be at the bottom and it is with the way I had it.
JM4
That will undo the sticky footer!
Doug
@doug - good recognition!
JM4
+1  A: 

Give your #wrapper div a background image that is the width and color of the content area with repeat-y.

Edit: Also center the background image!

Doug
@Doug - this would not work. a) the wrapper encompases the entire page; b) a repeating Y imagine is impossible considering the image I have in the content area is a vertical fade
JM4
@JM4 I realize that. But the image on the wrapper would appear *behind* the vertical fade image (and behind the header). Set it to the color at the bottom of the fade and it will "extend" the content area visually.
Doug
thanks for help here doug!
JM4
+1  A: 

Try this. Of course not with inline CSS like mine.

<html>
<head>
    <title>DIV Test</title>
    <style>
        body {
            margin: 0;
        }

        #container {
            height: 100%;
            width: 100%;
        }

        #header {
            background: #0000FF;
            position: absolute;
            top: 0;
            height: 100px;
            width: 100%;
        }

        #content {
            background: #FF0000;
            height: auto;
            width: 100%;
        }

        #footer {
            background: #00FF00;
            position: absolute;
            bottom: 0;
            height: 100px;
            width: 100%;
        }
    </style>
</head>
<body>
    <div id="container">
        <div id="header"><!-- header content here --></div>
        <div id="content"><!-- main content here --></div>
        <div id="footer"><!-- footer content here --></div>
    </div>
</body>

Hopefully that helps you.

EDIT: To point out what the solution is. Look at the header and footer CSS position attributes. That should solve it.

Octavian Damiean
@Mainerror - while this solution would be ideal for a header with image/single DIV (like the footer), it will not work where there are multiple divs as the container cannot be absolute while other items have separate properties
JM4
Just checked it out myself forgot to add content. You're right it won't fit your needs. Sorry.
Octavian Damiean
no worries - thank you very much for your help either way!
JM4