tags:

views:

49

answers:

3

My page ... http://webpages.charter.net/jolove/Escort_Folder/test.html

thanks to: fortysevenmedia.com/blog/archives/making_your_footer_stay_put_with_css

Now I have a functional footer that adheres to the bottom of the window ..

except now what I need to do is get the footer to stick to the bottom with the height of the scrollable area above the footer shrinking or expanding accordingly as the window height changes.

In other words, the window's vertical scroll bar should never appear.

John  

A: 

If correctly understand what you're trying to do it can be done using divs with percentage heights. Here is the basic idea:

<div id="header" style="height: 10%"></div>

<div id="scrollableContent" style="height: 60%; overflow: auto"></div>

<div id="footer" style="height: 30%"></div>

Using the percentage heights each div will resize according to the window size and only the scrollableContent div will have a scroll bar.

Phil Hale
[SOLVED] thanks to all who responded.http://webpages.charter.net/jolove/Escort_Folder/test3.htmlI didn't want the header or footer to change in height, so I didn't incorporate a % for either.I didn't really want a % in the scrollable content because the bottom of the scrollable content did not *quite* line up with the top of the footer.So .. I changed the scrollable content to position:absolute; with a matching top:(ht of header) and bottom:(ht of footer). The header stayed relative and the footer stayed absolute .. and no ugly? window scrollbar.Thanks again to everyone.
john love
Tested so far on just Mac, no Windows yet! Any takers?
john love
A: 

i am not sure if you wish the following just try it. on the #poemScroller change the height:28em; to height:auto;

Sotiris
Tried that with the result that #poemScroller extended below the #footer. I *think* that result makes sense because isn't 'auto' the equivalent of 100%.
john love
A: 

you can use static positioning to achieve the same behavior see this example

<html>
    <head>
        <style>
            #header{
                position:fixed;
                top:0;
                height:50px;
                z-index:5;
                width:100%;
            }
            #content{
                /* margin top should be >= header height 
                   this also applies for footer */
                margin: 50px 0;
                width:100%;
            }
            #footer{
                position:fixed;
                bottom:0;
                height:50px;
                z-index:5;
                width:100%;
            }
        </style>
    </head>
    <body>
        <div id="header" > <h1>This is header</h1> </div>
        <div id="content" >
            <p>alot of content</p>
        </div>
        <div id="footer" > <h1>This is footer</h1> </div>
    </body>
</html>
Barakat