Making Main Content Fill Page Perfectly
Page 1 of 18 Replies - 365 Views - Last Post: 11 February 2013 - 08:28 PM
#1
Making Main Content Fill Page Perfectly
Posted 11 February 2013 - 04:16 AM
I have a little question about page layouts.
Google (and a huge amount of other websites) have a way of spacing their page out perfectly, their footer is stuck perfectly to the bottom of the page without the need to scroll down to see it. The only way I know they could do this would be for example, set the navigation to 10%, content to 80%, and footer to 10%. I did notice however that they have used pixels to set the height of the footer and navigation bars.
With my site jskidd3.com I am trying to achieve something similar using pixels but I can't figure out how to do it. The main content area is 90% of the screen and my navigation and footer are set to 50%. To put it bluntly, I would just like the main content to perfectly fit in the centre of the page whilst using a pixel based navigation and footer.
If what I'm asking for isn't clear please say.
Thanks,
Joel
Replies To: Making Main Content Fill Page Perfectly
#2
Re: Making Main Content Fill Page Perfectly
Posted 11 February 2013 - 05:33 AM
Here is a good tutorial. Using position: fixed; is the easiest way.
The example uses height: 100%;. This only works if all parent-elements (all the way to body and html) have this height as well, or the immediate parent has a fixed height.
I suspect Google, and other pages, use a more complicated technique, perhaps using Javascript and the resize event to keep the footer correctly positioned.
BTW I notice that your page is tentatively accepted as HTML5 by the validator; never seen that before
Your page also has a pop-up of some kind which my browser disabled.
This post has been edited by andrewsw: 11 February 2013 - 05:35 AM
#3
Re: Making Main Content Fill Page Perfectly
Posted 11 February 2013 - 05:56 AM
Sorry about the pop-up thing, was just testing some Javascript, I have removed it now. If you check the site again now you'll see that the footer is at the bottom of the screen, thanks very much! Seems so simple I just couldn't figure it out. My question now is, do you know how I would stretch the main content area to go right down to the footer? Something along the lines of min-height: 100%?
Thanks again
This post has been edited by jskidd3: 11 February 2013 - 05:57 AM
#4
Re: Making Main Content Fill Page Perfectly
Posted 11 February 2013 - 06:06 AM
Quote
Of course, the best solution is to add more content
#5
Re: Making Main Content Fill Page Perfectly
Posted 11 February 2013 - 06:37 AM

Setting the #mid div (my main content area) to 100% doesn't seem to do anything. I'm assuming this is because the parent has a mid-height set and not a proper fixed height? Either way, I tried setting the parent to height: 100% as well as the #mid div but it didn't fit perfectly up to the footer. (it was too big)
This post has been edited by jskidd3: 11 February 2013 - 06:38 AM
#6
Re: Making Main Content Fill Page Perfectly
Posted 11 February 2013 - 07:07 AM
Create an entirely new page;
Study the tutorial and create the page that it guides you through;
Once you understand how it works, apply the principles to your own page.
#7
Re: Making Main Content Fill Page Perfectly
Posted 11 February 2013 - 07:21 AM
#8
Re: Making Main Content Fill Page Perfectly
Posted 11 February 2013 - 07:26 AM
jskidd3, on 11 February 2013 - 07:21 AM, said:
No worries. If you want your mid section to also stretch to the full height of the browser (less the footer height) then you'll need to investigate css full height div, one technique for which is to create a faux column.
But, as mentioned, the best solution is to have more content
#9
Re: Making Main Content Fill Page Perfectly
Posted 11 February 2013 - 08:28 PM
|
|

New Topic/Question
Reply



MultiQuote




|