954,598 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Web page layout: Displaying content appropriately based on screen size?

My web-page which can be seen on the URL link within this post.

Consists of a header, navigation panel, left column (text), right column(pictures) and a footer (All of these hav div tags assigned to them).

The footer is set to be displayed 20pixels from the bottom using the code below:-

#footer 
{
	border: 1px solid #000000;
	background: #CC99FF;
	text-align: center;
	position: absolute;
	bottom: 20px;
	right: 20px;
	left: 20px;
}


However, if the content of right/left columns is more than can be displayed on the current browser window the scroll bar is present and the footer isn't the last element to be displayed, as the contents of the left and right columns is displayed underneath.

If the footer is displayed directly after the content of left/right columns then the footer could potentially not be positioned 20 pixels up from the bottom of the screen.

The screenshot should hopefully explain this better than my words:- http://i140.photobucket.com/albums/r13/robtyketto/catsitenonfullscreen.png

I played around with overflow option without success, can anyone assist in providing possible solutions so the footer is always displayed at the bottom of the page?

Also I do not know if what I want is actually possible, which I guess to summarise is the text to always be clearly visible and a foot at the bottom of the page independant of the current browser display size.

Thanks and hope that made sense
Rob

Robtyketto
Light Poster
36 posts since Mar 2007
Reputation Points: 10
Solved Threads: 0
 

Firstly, unless you really no what you're doing do not set anything as position: absolute.

You should put your html code for your footer right at the end of your html document, ie just before

roryt
Nearly a Posting Virtuoso
1,286 posts since Oct 2005
Reputation Points: 178
Solved Threads: 15
 

Thanks for the advice and input, much appreciated.

I have cleared the settings from the previous divisions, I've attached the external css and xhtml files (Zipped) and images (zipped).

It's for a college course, hence the use of tables (I wouldn't use them in the real world), strange colours and simple layout.

I've haven't hosted it anywhere yet either.

Cheers
Rob

Attachments website.zip (1.54KB) images.zip (279.97KB)
Robtyketto
Light Poster
36 posts since Mar 2007
Reputation Points: 10
Solved Threads: 0
 

for a layout like yours
add margin-bottom to the leftcol rightcol css, large enough to accomodate the height of the footer,
the page will always scroll down to display the last line of text, in the largest column,
above the footer

almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376
 
for a layout like yours add margin-bottom to the leftcol rightcol css, large enough to accomodate the height of the footer, the page will always scroll down to display the last line of text, in the largest column, above the footer

Thanks for the input I used the following css and the problem still occurs:-

#leftcol 
{
	position: relative;
	margin-right: 250px; 
	margin-bottom: 100px;
}

#rightcol
{
	position: relative;
	float: right;
	width: 230px;
	margin-bottom: 100px;
}


I experimented with the position value too, including removing them altogether. All changes had the same end result.

Robtyketto
Light Poster
36 posts since Mar 2007
Reputation Points: 10
Solved Threads: 0
 

I played around with overflow option without success, can anyone assist in providing possible solutions so the footer is always displayed at the bottom of the page?

Also I do not know if what I want is actually possible, which I guess to summarise is the text to always be clearly visible and a foot at the bottom of the page independant of the current browser display size.

[indent]
It is barely possible, and to do it requires making an assumption about the height of the footer.

The closest you can easily do is something like this: http://cfaj.freeshell.org/testing/Robtyketto/ ; it works in Firefox, but not in IE6 (I don't know about IE7+).
[/indent]

cfajohnson
Junior Poster
196 posts since Dec 2008
Reputation Points: 25
Solved Threads: 23
 

[indent] It is barely possible, and to do it requires making an assumption about the height of the footer.

The closest you can easily do is something like this: http://cfaj.freeshell.org/testing/Robtyketto/ ; it works in Firefox, but not in IE6 (I don't know about IE7+). [/indent]

It does work in IE7 the size of the footer isn't always the exact same as the header. But I think its close enough.

Interesting to see how you had used the footer css settings having another div, never seen that before but now understand how it works.

Some of the other settings had me perplexed, so I'm experimenting.

Thanks, greatly appreaciated

Robtyketto
Light Poster
36 posts since Mar 2007
Reputation Points: 10
Solved Threads: 0
 

first of all for a better web design you should use % rather than the px or i think you can use em also
so your web pages can be easily fit in any screen resolutions.

try this if this works otherwise you should use float property for your left/right coloums.

i thnk it will help
-PC(INDIA)

cpeeyush1
Light Poster
29 posts since Sep 2008
Reputation Points: 10
Solved Threads: 2
 

You are trying to do something that can't be done in a way that works on all browsers, screen resolutions, and window sizes. There is no provision in the design of the internet for a footer that is at the bottom of the screen. You are wasting your time trying to do it.

The internet is NOT designed to display a page in the way a Windows program displays it. It is designed to present things in a continuous web of material from the top of the screen until the information runs out.

MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You