Click here to get back home

creating a scrolling and non-scrolling area on the page

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
creating a scrolling and non-scrolling area on the page Andy Fish 11-10-2006
Get Chitika Premium
Posted by Andy Fish on November 10, 2006, 10:12 am
Please log in for more thread options


Hi

I have quite a simple requirement. at the top of a page I would like to have
a fixed-height area (which will be used as a "toolbar") and the main the
content will be in the bottom part whch needs to occupy the rest of the
window and scroll of necessary. so the behaviour i'm looking for is similar
to having 2 frames but all in one page.

the following works fine in IE but not in firefox:

<body>
<table width="100%" height="100%">
<tr height="50">
<td>top bit</td>
</tr>
<tr>
<td>
<div style="OVERFLOW: auto; HEIGHT: 100%">
... lots of content in here....
</div>
</td>
</tr>
</table>
</body>

it's easy with fixed heights, but I want the bottom portion to always take
up the remainder of the window.

any idea how I can do this in a browser-independent way ?

Andy



Posted by Ben C on November 10, 2006, 12:30 pm
Please log in for more thread options


> Hi
>
> I have quite a simple requirement. at the top of a page I would like to have
> a fixed-height area (which will be used as a "toolbar") and the main the
> content will be in the bottom part whch needs to occupy the rest of the
> window and scroll of necessary. so the behaviour i'm looking for is similar
> to having 2 frames but all in one page.
>
> the following works fine in IE but not in firefox:
>
><body>
> <table width="100%" height="100%">
> <tr height="50">
> <td>top bit</td>
> </tr>
> <tr>
> <td>
> <div style="OVERFLOW: auto; HEIGHT: 100%">
> ... lots of content in here....
> </div>
> </td>
> </tr>
> </table>
></body>
>
> it's easy with fixed heights, but I want the bottom portion to always take
> up the remainder of the window.
>
> any idea how I can do this in a browser-independent way ?

I think the difficulty here is setting the div to be 100% the height of
its containing block, which is the <td>. But the <td>'s height depends
on its content, so I think Firefox is (as the spec says it should)
ignoring the 100% and using "height: auto" for the div instead.

And anyway, you don't want the div to be 100% of the viewport, because
then you'll get a scrollbar within the div, and another little scrollbar
on the viewport to take you the extra 50px or so to the bottom of the
div.

This is easier without tables. Try something like this (don't know if it
will work in IE):

<html>
<head>
<style type="text/css">
div
{
position: absolute;
border: 1px solid black; /* just for illustration */
left: 0;
right: 0;
}
#toolbar
{
top: 0;
height: 50px;
}
#main
{
bottom: 0;
top: 52px; /* +2 because of the borders */
overflow: scroll;
}
</style>
</head>
<body>
<div id="toolbar">
Top bit
</div>
<div id="main">
... content ...
</div>
</body>
</html>

Posted by Andy Fish on November 10, 2006, 1:04 pm
Please log in for more thread options


<snip>
>
> This is easier without tables. Try something like this (don't know if it
> will work in IE):
>
<snip>

Thanks ben.

this does the job in FF but unfortunately IE does exactly what FF did with
my attempt i.e. sizes the bottom div to the content and therefore scrolls
the whole window

seems strange that this should be so difficult in CSS because I would think
it's quite a common requirement

maybe the 2 frame approach is the path of least resistance after all....

Andy



Similar ThreadsPosted
Need help creating a "Click absolutely ANYWHERE on this page" link for an HTML page with no content February 7, 2007, 5:40 pm
Creating a simple XHTML page December 29, 2005, 12:19 pm
Fixed length page / scrolling div September 18, 2005, 1:12 am
Can I prevent an item from scrolling with the page? December 7, 2005, 12:56 pm
creating an index July 18, 2004, 1:25 am
Creating a timeline. September 7, 2006, 12:50 am
How to load first.html into a certain
...
area?
November 20, 2008, 1:47 pm
Creating Discussion Forums January 23, 2005, 7:03 am
Creating a category tree September 27, 2005, 12:13 am
creating your own webpage background January 4, 2006, 9:21 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap