Solved

Set up CSS so HTML is always 100% of browser view and footer is always on the bottom

Posted on 2011-03-15
12
363 Views
Last Modified: 2012-05-11
I want my site to display at 100% of the vertical space of the user's browser, with the footer always at the bottom of the page. This is especially important on pages that don't have a lot of content. I found a clever fix that has worked for me in the past here:

http://www.dave-woods.co.uk/index.php/css-fixed-footer/

Dave assigns the HTML height to 100% and places the footer at the bottom of that with some margin adjusting.

This works fine on this page:

http://justthedriver.com/employment/employment.htm

BUT doesn't work on this page:

http://justthedriver.com/contact/contact.htm

I'm guessing it has something to do with the Column L & Column R spacing on the Contact.htm page? Not sure though.

Please advise.

Thanks Experts!
0
Comment
Question by:TonyT7220
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
12 Comments
 
LVL 4

Expert Comment

by:dwkd
ID: 35142856
employment page doesn't work neither in FF or IE

footer inline style has another 'style' tag inside of it
style:list-style-type: none;

remove that first
0
 
LVL 4

Expert Comment

by:dwkd
ID: 35142900
you need to start at the top with the width:100%
body is not the top element

first is html
so:

html {
      height: 100%;
}

then

body{
       height: 100%;
}

then

#container {
      height: 100%;
}

0
 
LVL 42

Expert Comment

by:David S.
ID: 35143074
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:dwkd
ID: 35143145
i swear to Budha i didn't copy your answer :)
0
 
LVL 42

Expert Comment

by:David S.
ID: 35143224
It's a widely known technique.  I'd use "min-height" instead of "height" for "#container" so that it will expand as needed.
0
 
LVL 4

Expert Comment

by:dwkd
ID: 35143304
non-floated extra content will force the height to expand either way
0
 
LVL 42

Accepted Solution

by:
David S. earned 250 total points
ID: 35143432
No. With the "height:100%" content taller than that will overflow the bottom instead of making "#container" expand in height. In some situations you can't tell the difference, but others (like if you have a vertically repeated background image on it) it makes a significant difference.
0
 
LVL 4

Expert Comment

by:dwkd
ID: 35143465
correct! ..props!
0
 
LVL 4

Expert Comment

by:dwkd
ID: 35143532
ha, you win! ...and you didn't even give the answer(in this post)  :)
0
 
LVL 42

Expert Comment

by:David S.
ID: 35143557
It might not last. I requested the attention of a moderator before you made your initial reply. The moderator might delete this or split the points when he reviews this.
0
 
LVL 4

Expert Comment

by:dwkd
ID: 35143571
s'all good
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question