473,382 Members | 1,302 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

creating a scrolling and non-scrolling area on the page

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
Nov 10 '06 #1
2 8387
On 2006-11-10, Andy Fish <aj****@blueyonder.co.ukwrote:
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>
Nov 10 '06 #2
<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
Nov 10 '06 #3

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

Similar topics

3
by: Dan | last post by:
Hi I tried the following from the help file... When you create or modify a unique index, you can set an option to ignore duplicate keys. If this option is set and you attempt to create...
6
by: owen | last post by:
Generally speaking, what does it mean when I see a "button" with red text showing this message instead of the control I've dragged onto the web form in Design View.? (But the page works fine at...
2
by: gkelly | last post by:
What is the best soltions for creating a graphical object in c# for use in a C++ app? - I heard some say you can't create an ActiveX control in dotnet and I have heard others say you can using...
15
by: Carlos Lozano | last post by:
Hi, What is the right way to create an OCX COM component. The component is already registerred, but can't create an instance. I am using the reference to the interop module created. If I use...
4
by: blee456 | last post by:
I have to create an attendance list for a meeting that will have attendees that are both on the committee and non member participants. My thinking is to create a form that has the member names...
22
by: ypjofficial | last post by:
Is there any possibility of invoking the member functions of a class without creating an object (or even a pointer to ) of that class. eg. #include <iostream.h> class test { public: void...
7
by: Gladiator | last post by:
Hai all, I have Db2 installed in a partition environment . There are 4 partitons on which i created the instance. can any one tell me if i can create a database on the required partitons .........
10
by: Jess | last post by:
Hello, If I create a temporary object using a dynamically created object's pointer, then when the temporary object is destroyed, will the dynamically created object be destroyed too? My guess...
3
by: Bartholomew Simpson | last post by:
I am writing some C++ wrappers around some legacy C ones - more specifically, I am providing ctors, dtors and assignment operators for the C structs. I have a ton of existing C code that uses...
19
by: =?Utf-8?B?WWFua2VlIEltcGVyaWFsaXN0IERvZw==?= | last post by:
I'm doing my c# more and more like i used to code c++, meaning i'm casting more often than creating an instance of objects. like : protected void gvOrderDetailsRowDataBound(object sender,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.