Jump to content

Footers


monkeytooth

Recommended Posts

You know Im sure I can google this and find it, if.. I was looking for the right thing. But basically what I want is the ability to have my footer always be at the bottom unless the content spans lower than the screen. Lets just say for the sake of ease I have a rather simple Header, Content, Footer style template.

 

Taking into mind that resolutions on everyones PC's are different, and there browsers are different and so on and so forth.. whats the best way to get my footer to only be at the bottom of the page when the content itself isn't filling the page lets say I've only got a couple lines of content on one page I dont want the footer to bounce up to match that. I do want a footer though.

Link to comment
Share on other sites

maybe i can help here...

 

you can have a main div with a certain height and and within this main div you can have a number of divs with a height set to a PERCENTAGE of that main div's height, the last div within this main div would be the footer.

 

so for example you call the first div within the main div HEADER you can give it a height of say 15% and  CONTENT div  80% and finally a FOOTER div with height 5% and this should guarantee that this footer is always at the bottom, and the leaset in size...

 

hope this helps...

Link to comment
Share on other sites

I was thinking about percents.. but the header/footer would actually be hight specific, well maybe not the footer (on this particular page at least). Which throws my ideas off on the percentage base. I was thinking of a fixed position element but even then that makes no sense to me with the ideal concept I would like to have.. Im thinking min-height on the content element may be my best bet, but how far does min-height go back? does IE 6 support it? Even though min-height doesnt cover my bases on all resolutions, it covers my bases to an exent, larger resolutions I guess will just be what it is, maybe I can work something up in JavaScript to get the height/width of the viewing pane and set it accordingly if the height exceed's the min-height I would set. I dunno.. much to think about I supose, thank you.

Link to comment
Share on other sites

I was thinking about percents.. but the header/footer would actually be hight specific, well maybe not the footer (on this particular page at least). Which throws my ideas off on the percentage base. I was thinking of a fixed position element but even then that makes no sense to me with the ideal concept I would like to have.. Im thinking min-height on the content element may be my best bet, but how far does min-height go back? does IE 6 support it? Even though min-height doesnt cover my bases on all resolutions, it covers my bases to an exent, larger resolutions I guess will just be what it is, maybe I can work something up in JavaScript to get the height/width of the viewing pane and set it accordingly if the height exceed's the min-height I would set. I dunno.. much to think about I supose, thank you.

 

try this:

 

<body>
        <div id="Main" style="width:800px; height:800px; background: green; margin: auto; padding: 5px;">
            <div id="Header" style="height:10%; background:red;">
            <div id="Content" style="height:85%; background:yellow;">Content</div>
            <div id="Footer" style="height:5%; background:blue;">Footer</div>
  </div>
        
    </body>

the colors  show the effect

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.