473,806 Members | 2,565 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Allocate "rest" of height to a div?

I have this:

<div style="width:10 0%;height:20px" >
bla
</div>
<div style="width:10 0%;height:???;o verflow:scroll" >
something
very
tall
so
that
it
produces
a
scrollbar
</div>
<div style="width:10 0%;height:50px" >
another stuff
</div>

The three question marks indicate what I want to put there. What I
want to say is "window height minus 20px minus 50px", but I don't know
how to say it.

My current workaround is to put some JavaScript before </body> which
calculates the height of the window in pixels, subtracts 75 from this
number (75 = 20 + 50 + fudge factor), then frobs the DOM of the
document to say "width:4711 px" instead of "width:???" .

The problem with this workaround is that the corresponding div doesn't
resize when the user resizes the window: while the divs get narrower
or wider properly when the user resizes the window, the middle one
doesn't get taller or --err, less tall?-- during the resizing.

On a whim, I also tried "width:90%" but that resulted in the div
growing as tall as the "something tall" inside it.
I hope I made it clear what I want. Flame away, if I didn't.

Suggestions?
Kai
Jul 20 '05 #1
11 4468
Kai Grossjohann wrote:
I have this:

<div style="width:10 0%;height:20px" >
bla
</div>
<div style="width:10 0%;height:???;o verflow:scroll" >
something
very
tall
so
that
it
produces
a
scrollbar
</div>
<div style="width:10 0%;height:50px" >
another stuff
</div>

The three question marks indicate what I want to put there. What I
want to say is "window height minus 20px minus 50px", but I don't know
how to say it.
Only way is JavaScript AFAIK

My current workaround is to put some JavaScript before </body> which
calculates the height of the window in pixels, subtracts 75 from this
number (75 = 20 + 50 + fudge factor), then frobs the DOM of the
document to say "width:4711 px" instead of "width:???" .
You mean height:???;, right?

The problem with this workaround is that the corresponding div doesn't
resize when the user resizes the window: while the divs get narrower
or wider properly when the user resizes the window, the middle one
doesn't get taller or --err, less tall?-- during the resizing.


That is possible to detect using JS (the resizing part).
--
Anne van Kesteren
<http://www.annevankest eren.nl/>
Jul 20 '05 #2
Can't you fix the bottom div to the bottom of the viewport so you don't
have to specify a height on the middle?

On Wed, 12 Nov 2003 19:15:18 +0100, Anne van Kesteren wrote:
The three question marks indicate what I want to put there. What I want
to say is "window height minus 20px minus 50px", but I don't know how to
say it.


Only way is JavaScript AFAIK


--

..

Jul 20 '05 #3
Vigil <me@privacy.net > wrote in
news:pa******** *************** *****@privacy.n et:
Can't you fix the bottom div to the bottom of the viewport so you
don't have to specify a height on the middle?


That causes more problems than it solves. If for whatever reason the
viewport isn't tall enough to display the entire page, then a fixed footer
will stick at the bottom of the viewport and content will scroll underneath
it.
Jul 20 '05 #4
Anne van Kesteren <ma**@annevanke steren.nl> wrote in message news:<bo******* ***@reader11.wx s.nl>...
Kai Grossjohann wrote:

The problem with this workaround is that the corresponding div doesn't
resize when the user resizes the window: while the divs get narrower
or wider properly when the user resizes the window, the middle one
doesn't get taller or --err, less tall?-- during the resizing.


That is possible to detect using JS (the resizing part).


How to detect this? Do I set a timer that checks every 400ms whether
the window has changed its size, or is there an event that fires when
the user resizes the IE/Mozilla/... window?

Kai
Jul 20 '05 #5
Vigil <me@privacy.net > wrote in message news:<pa******* *************** ******@privacy. net>...
Can't you fix the bottom div to the bottom of the viewport so you don't
have to specify a height on the middle?


What does it mean to "fix [a] div to the bottom of the viewport"?

Kai
Jul 20 '05 #6
Not if you make the middle scroll?

On Thu, 13 Nov 2003 02:56:01 +0000, Eric Bohlman wrote:
That causes more problems than it solves. If for whatever reason the
viewport isn't tall enough to display the entire page, then a fixed footer
will stick at the bottom of the viewport and content will scroll
underneath it.


--

..

Jul 20 '05 #7
Kai Grossjohann wrote:
That is possible to detect using JS (the resizing part).

How to detect this? Do I set a timer that checks every 400ms whether
the window has changed its size, or is there an event that fires when
the user resizes the IE/Mozilla/... window?

Kai

I think you need something like this:
<http://www.google.com/search?q=javasc ript+onresize> ;-)
--
Anne van Kesteren
<http://www.annevankest eren.nl/>
Jul 20 '05 #8
Anne van Kesteren <ma**@annevanke steren.nl> writes:
I think you need something like this:
<http://www.google.com/search?q=javasc ript+onresize> ;-)


Ah, it seems the JavaScript reference I'm using is incomplete...

Kai
Jul 20 '05 #9
CJM
"Vigil" <me@privacy.net > wrote in message
news:pa******** *************** *****@privacy.n et...
Not if you make the middle scroll?

And how do you do that?
Jul 20 '05 #10

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

Similar topics

12
9717
by: bhennon | last post by:
Hey all, I have a small php script that calls a random image at the following page. http://www.2006ymcanationals.com/random.php IT WORKS IF I go directly to the above link. I am trying to call that in another page so that i get a random image the page is http://2006ymcanationals.com/index.php using <img
0
1478
by: BW | last post by:
Please ignore the rest of the code, except for the highlighted part (or the line 'ent1=Entry(topf, width=25)' to line 'ent1.insert(INSERT, wrong, if you cannot see the color). You can copy this into Python and make sure you have the GIF file in the same dir. Also, make sure that you have PIL installed. I cannot get this to work. I get an error after running it and what I'm trying to do it to evaluate what the person enters in the box for the...
8
2481
by: Ryan R. Rosario | last post by:
Hi - **I apologize for posting this again. I dont think my first one went thru** I am in the process of converting a table based website over to a CSS based website and I am having a problem. The website "template" consists of 3 regions: header, sidebar and content. Header spans horizontally across the screen at the top of the
2
2219
by: TadPole | last post by:
Hi all, My main problems are::::::::: 1. Set a value within a block container that can be used and changed by subsequent templates/block-containers/tables etc.. 2. get/determine/find the setting that tell the process that the new top of the document region is now at the end of the last block-container used, this must be set in that last block container. 3. find the value used in the 'top" setting on the prior
145
6358
by: Sidney Cadot | last post by:
Hi all, In a discussion with Tak-Shing Chan the question came up whether the as-if rule can cover I/O functions. Basically, he maintains it can, and I think it doesn't. Consider two programs: /*** a.c ***/
7
7024
by: bijax | last post by:
hi, i am new to multidimensional array of c programming .pls help me to solve out this how to allocate memory for mutidimensional array? i.e a ;
12
8131
by: Olaf Baeyens | last post by:
I am porting some of my buffer class code for C++ to C#. This C++ class allocates a block of memory using m_pBuffer=new BYTE; But since the class is also used for pointers for funtions that uses raw MMX and SSE power, the starting pointer MUST be starting at a 16 byte memory boundary. In C++ I allocate more memory than needed, and in a second phase I search for the address that starts on a 16 byte boundary. And I then use that new...
13
4006
by: royaltiger | last post by:
I am trying to copy the inventory database in Building Access Applications by John L Viescas but when i try to run the database i get an error in the orders form when i click on the allocate button "Unexpected Error":3251 operation is not supported for this type of object.The demo cd has two databases, one is called inventory and the other just has the tables for the design called inventory data. When you run inventory the database works...
17
2428
by: Chen Shusheng | last post by:
Hi all, In fact, I want to let my memory run out. And see what will happen. My system is windowsXp. Memory is 256M.I think my cdes will apply more memory than I have. Codes are below: #include <stdlib.h> #include<stdio.h> #define MAX 1000000000
0
9719
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
9597
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
10620
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
10369
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
10372
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,...
1
7650
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...
1
4329
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
3851
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.