473,725 Members | 2,251 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tables VS. CSS (Footer at the bottom, 100% of the viewport)

I've tried to get CSS to give me a basic layout where I can place a
footer at the bottom of the page and the top of the page I can use for
content. I don't however want the footer to pull away from the bottom
of the viewport if the top content is small. Also, when I resize the
window I want the footer to move with the bottom of the page until I
reach the content.

Here is an example that works both in IE and Mozilla using tables. I
aslo had to use quirks mode for IE. I want to get rid of quirks mode
and use div's. Personally I don't think it can be done.

code:

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<style type="text/css">
body{margin:0px ;padding:0px;}
table{border-collapse:collap se;height:100%}
td{padding:0px}
#top{ background-color:red;verti cal-align:top}
#bottom{height: 100px;
background-color:yellow;ve rtical-align:top}
</style>
</head>
<body>
<table>
<tr id="top">
<td>
<h1>header</h1>Takes up the viewport minus the footer
</td>
</tr>
<tr id="bottom">
<td>
<h1>footer</h1>Located at the bottom
</td>
</tr>
</table>
</body>
</html>
Jul 20 '05 #1
5 14393
"Tyler Carver" <xf**********@y ahoo.com> wrote in message
news:81******** *************** ***@posting.goo gle.com...
I've tried to get CSS to give me a basic layout where I can place a
footer at the bottom of the page and the top of the page I can use for
content. I don't however want the footer to pull away from the bottom
of the viewport if the top content is small. Also, when I resize the
window I want the footer to move with the bottom of the page until I
reach the content.


The following roughly thrown together page works for IE6 but isn't quite
right for Opera7.54 or Netscape7.1
Opera needs the page refreshing after it loads or the window is resized
and Netscape brings up a vertical scroll bar.

I'm not sure why it doesn't work properly, being new-ish to CSS myself, so
will watch for any replies with interest.

=============== ==

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Test Page</title>
</head>

<body>

<div style="width:10 0%; position:absolu te; bottom:0; text-align:center">T HIS
IS THE BOTTOM!</div>

</body>
</html>
Jul 20 '05 #2
xf**********@ya hoo.com (Tyler Carver) writes:
I've tried to get CSS to give me a basic layout where I can place a
footer at the bottom of the page and the top of the page I can use for
content. I don't however want the footer to pull away from the bottom
of the viewport if the top content is small.
Have multiple advice with decreasing value:

1) Stop wanting that
2) Keep using a table
3) <http://sandbox.bednarz .nl/css/height/footer.html>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> \
The FPI is case sensitive
table{border-collapse:collap se;height:100%} #bottom{height: 100px;
background-color:yellow;ve rtical-align:top}


You're better off declaring basically

body
{
margin: 0;
padding: 0;
}
html,
body,
table
{
height: 100%;
}
#bottom
{
vertical-align: bottom;
}

and then finetune the appearance of the box that is stuck in #bottom.
--

Più Cabernet,
meno Internet.
Jul 20 '05 #3
Eric B. Bednarz <be*****@fahr-zur-hoelle.org> wrote in message news:<m3******* *****@email.bed narz.nl>...

Have multiple advice with decreasing value:

1) Stop wanting that
I've had this response a number of times. Which is why I think css is
inadequate and has a long way to go. Many reasonable and simple
things are next to impossible (especially with layout).
2) Keep using a table
It seemed I had no other option. It was solved in two seconds with a
table but I had to leave IE in quirks mode (which I hate).

3) <http://sandbox.bednarz .nl/css/height/footer.html>
This page didn't load.
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">

\
The FPI is case sensitive


Thanks for the tip. Stupid Visual Studio .Net formatting (which you
can't completely turn off).
Jul 20 '05 #4
xf**********@ya hoo.com (Tyler Carver) wrote:
1) Stop wanting that
I've had this response a number of times. Which is why I think css is
inadequate and has a long way to go.


Does it? A footer should be positioned relative to the content,
positioning it relative to the viewport makes no sense on the web where
you have no idea of or control over the viewport height.
Many reasonable and simple
things are next to impossible (especially with layout).


Most problems are not the result of lack css inadequacies, but because
css support in IE is relatively poor.

--
Spartanicus
Jul 20 '05 #5
On 2 Sep 2004 09:21:48 -0700, Tyler Carver <xf**********@y ahoo.com> wrote:
Eric B. Bednarz <be*****@fahr-zur-hoelle.org> wrote in message
news:<m3******* *****@email.bed narz.nl>...

Have multiple advice with decreasing value:

1) Stop wanting that


I've had this response a number of times. Which is why I think css is
inadequate and has a long way to go. Many reasonable and simple
things are next to impossible (especially with layout).


Depends on how you define "reasonable ". By putting an element as low as
possible - with variable space between it and the preceding content - you
are essentially asking the browser to tack it onto the bottom chrome or
lower. That's not a content-driven design.

Regardless of how attractive it is, that's not how CSS was designed.
Ultimately, what is lost if the footer bar is not flush to the bottom
chrome? Other than a perceived notion that there's wasted space below
(which is not really wasted, just extra)? You still have a very usable
page.

Remember, CSS thinks of the height of the page based on the content, not
on the viewport. Which makes all sorts of sense if you really think about
it.
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

82
10687
by: Peter Diedrich | last post by:
The site design is pretty simple: ============================================ | Head | ============================================ | | | | | | | | | left | center | right | | | | | | | | |
1
11300
by: Ron Bott | last post by:
I have a layout that has a fixed size #container <div> with a shadow running along the right side that encloses the content area. I would like the shadow background to extend to the full height of the page, not just the viewport. Here is some code: html, body { height: 100%; margin: 0; padding: 0;
3
1799
by: Gary Finnigan | last post by:
I have a three column layout that is preventing the footer from showing. The page is at www.clickatdepaul.org Can anyone suggest what might be the problem|? Gary -- Regards Gary Finnigan ICT Co-ordinator - Click@depaul
31
3688
by: Neil | last post by:
I have an Access 2000 MDB with ODBC linked tables to a SQL Server 7 back end. I currently have a selections table in the front end file which the users use to make selections of records. The table has two fields -- primary key (which matches primary key of main, SQL Server table), and a boolean field. The table is linked to the main table in a heterogeneous inner join. I'm looking to move the table to the back end, while still giving each...
4
1468
by: steve | last post by:
Hi All I am having annoying problems with VS 2005 (VB) positioning tables on a web page If I create HTML tables for layout, sometimes the next table sits at the bottom of the above table and other times there is a gap of about 10mm between them I am at a loss as the code is identical
1
1034
by: abc | last post by:
I don't know How to use HTML's DIV Tag to do that web page which have header (Top), content (datagrid) with scroll bar, and bottom footer. How should I do?
1
1967
by: Okie | last post by:
I'm trying to make a three panel page. Two panels on the left (top and bottom) and a content panel on the right. I want the viewport to never scroll. The left menu (two panels vertically) set at 300px, contains a top menu stretching to fit content (vertically), and the bottom menu filling the remaining space of the 100% height. This is what I currently have (or at least the jist of it): html, body { height: 100%; } body, div {...
11
2421
by: Michael7 | last post by:
Hi everyone, Me again, been a while since I've been here, but I'm back again needing help with a simple thing. I've searched for help on creating a footer, but all the help I've found, was absolutely nothing like what I was looking for. Could anyone help me with the very simple issue of creating a footer? I'm trying to create it on my index page (and all of the others, once I figure out HOW :) ) Here is the page:
1
3596
by: soms2m | last post by:
HELLO ALL, I want to fill the parent window height with respect to the sub window height which is loading using ajax (mootools). For example if the parent window height is normal and the loading child window height is 1200px (saying), when the child window load the height of the parent window changs but the backgorund color which is given 100% not fill the parent window. I have given my example codes, please give a solution as soon as...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9179
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9116
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.