473,732 Members | 2,204 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8414
On 2006-11-10, Andy Fish <aj****@blueyon der.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
6121
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 duplicate keys by adding or updating data that affects multiple rows (with the INSERT or UPDATE statement), the row that causes the duplicates is not added or, in the case of an update, discarded.
6
6117
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 runtime). Does it indicate a problem with References for example? Thanks Owen PS. replies cc'd by email appreciated. owen.southwood@mantix.com
2
2048
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 some non-standard sutff that may not be supported later on in dotnet. Is it or is it not possible? - Is it pratical to have the C++ app ( non-managed c++ btw ) send a hwnd to c# and have the c# app overlay itself on the hwnd? If so, does anyone...
15
6749
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 javascript or vbscript it works. I will appreciate any help. I do the following (C#):
4
6014
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 listed with a check box next to their names in one section of the form, and a list box in another section to fill in those non-member attendees. To complicate matters, the report must show name and title, which are 2 distinct fields. Also, the...
22
2770
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 fun() {
7
2845
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 ...... that is i want to create the db on 1,3,4 partitons.
10
2579
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 is that it's not destroyed, but I'm not sure. I have the following program: #include<iostream>
3
2283
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 these structs. A typical usage case will be as ff (note the code below is Pseudocode and WILL NOT compile) //example structs (I have left out the ctors/dtors etc for brevity sake) struct MyStructA
19
1951
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, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { switch (((Sale)e.Row.DataItem).SzPN) {
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8774
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
9447
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
9307
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...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6735
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
4550
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...
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.