Solved

100% height on all pages is it possible with this design?

Posted on 2011-03-04
4
211 Views
Last Modified: 2012-05-11
I have a design that I have to modify... I can only modify the code a little (2 include files).

We're going from a flexible layout to a fixed 960 width. No problem there. I also have to change the header and footer. No problem with most of this... except:
I have to have the footer stuck to the bottom of the view screen, no matter the content height. This is not what we do now.

here is the site in test mode:
http://ulsandbox.org/research/media/index.html

We use the YAML CSS framework.

The most relevant style sheet is probably this one:
http://ulsandbox.org/mainul/11/css/yaml_33/yaml/screen/basemod_grids.css

To see my issue view this short page:
http://ulsandbox.org/research/journals/index.html
or this long page:
http://ulsandbox.org/research/media/index.html

I can get the footer to stick on the short pages, but on the long pages, it is in the middle of the content area, not stuck to the bottom.

I validated the page as well as the CSS... I am missing something!
0
Comment
Question by:Researcher37
  • 2
4 Comments
 
LVL 3

Author Comment

by:Researcher37
ID: 35040202
I think I solved my own problem- but would welcome suggestions... or feedback; visit urls above. Thanks!
0
 
LVL 42

Accepted Solution

by:
David S. earned 500 total points
ID: 35042008
There are several variants to the technique for doing that. (It's often called "CSS Sticky Footer".) You've gotten close by giving "min-height:85%" to "#header", but 85% won't work as well as one would like for all viewport sizes.

Here's how I'd do it:
#header {
	background: #fff;
	margin: -142px auto 0; /* negative top margin makes room for the footer */
	min-height: 100%;
	width: 960px;
}

#pagewrap {
	padding-top: 142px; /* to move the content back down so the top isn't cut off */
	width: 100%; /* for IE7 */
}

Open in new window

The 142px is the total height of the footer, which in this case is "height:137px" plus "margin-bottom:5px".

P.S. Can you really not make it so the "#header" element is inside the "#pagewrap" element instead of the other way around?
0
 
LVL 3

Expert Comment

by:prafullamjn
ID: 35144578
It is good that not to give any height in the page
just you can give the width.
height will take automatically according to the content you give.

thanks..
0
 
LVL 3

Author Comment

by:Researcher37
ID: 35147790
Kravimir:: no, not with this update, unfortunately.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
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…

705 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now