473,396 Members | 1,933 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,396 software developers and data experts.

Fixed size three row table with middle row 100% of remaing space

Hi can anyone please help?

I have a need to make a table of fixed size, containing three rows, where the middle row auto expands to fill the remaining space between the top and bottom rows.

Here is what I have so far, unfortunately using height:100% for the middle row blows the size of the table!


Expand|Select|Wrap|Line Numbers
  1. <html>
  2.     <head>
  3.         <title>Auto expanding middle row!</title>
  4.         <style type="text/css">
  5.             html, body {
  6.                 width:100%; height:100%; margin:0; padding:0;
  7.             }
  8.             #fixed { 
  9.                 width:300; height:300; border:1 solid #f00; 
  10.             }
  11.             #top { 
  12.                 text-align:center; vertical-align:top; background-color:#006699; position:relative; left:0px; top:0px; 
  13.             }
  14.             #content { 
  15.                 text-align:center; vertical-align:top; background-color:#CCCCCC; position:relative; top:0; bottom:0; height:100%;
  16.             }
  17.             #bottom { 
  18.                 text-align:center; background-color:#666666; position:relative; bottom:0;
  19.             }
  20.         </style>
  21.     </head>
  22.     <body>
  23.         <div id="fixed">
  24.             <div id="top">first row contents, may be quite long so that it overflows and wraps</div>
  25.             <div id="content">second is expanded to fill the remaining available space...</div>
  26.             <div id="bottom">third row contents, and also may be quite long so that it overflows and wraps</div>
  27.         </div>
  28.     </body>
  29. </html>
I am aware of the opinion about using fixed layouts.
In this case there I believe there is a valid reason for using a fixed layout table.
There are plenty of threads already out there putting the cases for and against using them. I realy dont think we need to get into another discussion about whether or not I should be using a fixed layout in the first place.
Mar 21 '08 #1
3 3835
drhowarddrfine
7,435 Expert 4TB
You haven't assigned units to your sizes. All sizes must have px, ems, etc. So to your height/weight, make it 300px.

Also, make sure you are using a doctype.
Mar 21 '08 #2
Ah here lies the problem, I do not know what the height of the top or bottom rows are! They are filled dynamically and I want them to expand according to the contents.
Mar 21 '08 #3
The page is being generated by an XSL, and the contents of the top and bottom divs are not known until processing. So I do not know what height to set the top and bottom divs

here is my validated code.
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
  3. <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  4.     <head>
  5.         <title>Auto expanding middle row!</title>
  6.         <style type="text/css">
  7.             html, body {
  8.                 width:100%; height:100%; margin:0px; padding:0px;
  9.             }
  10.             #fixed { 
  11.                 width:300px; height:300px; border:1px solid #f00; 
  12.             }
  13.             #top { 
  14.                 text-align:center; vertical-align:top; background-color:#006699; position:relative; left:0px; top:0px; 
  15.             }
  16.             #content { 
  17.                 text-align:center; vertical-align:top; background-color:#CCCCCC; position:relative; top:0px; bottom:0px;
  18.             }
  19.             #bottom { 
  20.                 text-align:center; vertical-align:top; background-color:#666666; position:relative; bottom:0px;
  21.             }
  22.         </style>
  23.     </head>
  24.     <body>
  25.         <div id="fixed">
  26.             <div id="top">first row contents, may be quite long so that it overflows and wrap</div>
  27.             <div id="content">second row, is required to expanded to fill the available space.</div> 
  28.             <div id="bottom">third row contents, and also may be quite long so that it overflows and wraps</div>
  29.         </div>
  30.     </body>
  31. </html>
  32.  
I can do what I want with javascript, but i would rather do it in CSS if possible.
Mar 24 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Cedric Villat | last post by:
I'm messing around the width of a table and can't see to get it right. Let me explain what I am trying to do. I have 5 cells in 1 row. The first cell I would like to be 20% of the screen space. The...
179
by: SoloCDM | last post by:
How do I keep my entire web page at a fixed width? ********************************************************************* Signed, SoloCDM
5
by: Andrew | last post by:
Could someone please tell me why this simple table test is completely mangled by Netscape? HTML: <TABLE WIDTH="90%" ALIGN="center" BORDER="0" CELLPADDING="0" CELLSPACING="1" BGCOLOR="Black">...
3
by: Mario | last post by:
i have three rows on my main site i want that the middle-row resizes (only height) depending on the windows size i know it is possible in javascript, but i dont know how ot do it im more like...
2
by: Eugene Anthony | last post by:
I am having a problem with this code. The problem I am facing is that the first image is displayed in its original size. But when I click the next button, the next image not displayed in its...
3
by: cbradio | last post by:
Hi, I am having trouble developing a form in a restricted environment. My sample code is found below my message (sorry I don't have a URL). Basically, without a doctype, the form displays properly...
31
by: Sarita | last post by:
Hello, this might sound stupid, but I got a really nice homepage template which unfortunately is a 3-Column Fixed Width CSS format. Now I don't have any content for the right column and would...
1
by: chrisj | last post by:
I'm using freeASPupload and got some assistance integrating to a Member script. It works successfully. In this modified version there are two groups that use this upload script. Members of one...
0
by: RubbedLung | last post by:
http://www.hometeamproperties.net/Forms/PVA/LPV.htm As you can see its a valid page but now the bottom right rounded corner is gone, and there are entire blocks of color missing from the interior...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
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,...
0
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,...
0
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...
0
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...
0
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...
0
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,...

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.