473,495 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Vertical layout -- evenly spacing items

I have a site that I laid out with tables, and lots of grotty hacks
and lots of markup generated by client-side javascript.
I'm in the process of converting it to "nice" CSS code but have
got stuck on a couple of issues.

My pages are going to be used in a situation with fixed viewport
(1024x768) and Mozilla browser -- so there are no resizing /
browser issues to worry about.

My basic page layout is:

<BODY>
<DIV id="header"> ...stuff... </DIV>
<DIV id="general"> ...stuff... </DIV>
<DIV id="footer"> ...stuff... </DIV>
<BODY>

I have positioned the footer with:
#footer { position: absolute; bottom: 10px; width: 98% }
and no special styling for the header.

Now I would like the "general" section to be all of the empty
space (ie. start at the bottom of Header, and end at the top
of Footer). So that I can then position stuff inside the empty
area. How do I do this?
The height of the section will change depending on what the
actual content of Header and Footer are, so I can't just make
it a fixed size.

Second question: suppose we have solved the above problem and
now have the "general" section. The general section will contain
two subsections:
<DIV id="general">
<DIV id="stuff1"> ...stuff... </DIV>
<DIV id="stuff2"> ...stuff... </DIV>
</DIV>
and these sections are both { width: 100%; height: 150px }.
I would like to position these two sections evenly within
the "general" space. One way to do this is with a table-based
layout:
<DIV id="general">
<TABLE width="100%" height="100%">
<TR><TD><DIV id="stuff1"> ...stuff... </DIV></TD></TR>
<TR><TD><DIV id="stuff2"> ...stuff... </DIV></TD></TR>
</TABLE>
</DIV>
This seems to work OK. Is it the recommended solution or is
there a better way of doing vertical alignment?

Now for the tricky part. Depending on the GET parameters in
the URL, sometimes I will only have "stuff1" visible, sometimes
I will only have "stuff2" visible, and sometimes both will be
visible. If only one is visible, then it should be vertically
centred within the "general" space.

The only solution I have so far is to output the entire code block
above with some JavaScript, and then I can just not output one of
the table rows if it is not to be used, and then the other row
is correctly centred. But this seems very ugly to me.

I tried attaching a { visibility: collapse } to the code above:
<TR style="visibility: collapse"> ....
That made the row contents disappear, but then the other row
was NOT centred. It moved a little towards the centre from where
it was, but that's all.

Nov 3 '05 #1
0 2249

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

Similar topics

3
13546
by: Paul E Collins | last post by:
Hello. Why doesn't 'test' appear at the bottom of its cell when I use the following markup? How should I achieve this instead? <table border=1> <tr> <td>...
13
77663
by: Dave | last post by:
Hi, what Property and Values are used to space out further from one another the items in a list (assuming it's possible)? The default presentation is a bit "bunched up" for me. Thanks, Dave
1
2043
by: Marek Mänd | last post by:
<style> ..menu{ background:yellow; font:12px Arial; } ..menu li{ margin-bottom:0; margin-top:0; padding-bottom:0; padding-top:0;
2
21796
by: webmaker | last post by:
I have a table that is a menu containing 10 items horizontally. I want it to be able to stretch across the screen sizing itself appropriately. I have each item in a separate table cell and I was...
5
2613
by: Rick Spiewak | last post by:
I'm using a DataList inside a Grid Layout Panel (which ends up being a <DIV>) so that I can use the overflow:scroll property. This is working fine, except for one anomaly: If there aren't enough...
1
6143
by: dave8421 | last post by:
Hi, I have a (strict) html document with the following portion: <ul> <li><img alt="" src="images/image1.jpg" /></li> <li><img alt="" src="images/image2.jpg" /></li> <li><img alt=""...
1
3326
by: quantass | last post by:
Just a quick question in regards to the Obout Tree View. How do i go about adjusting the horizontal spacing before & after the plus/minus button for each node seperately? Also how do i adjust the...
2
5865
by: spacix | last post by:
Does anyone know a work around for "table-layout: fixed;" to prevent the automatic evenly space cells width without assigning classes or ID to cells? My program prints a HTML "report" file and I...
3
4564
by: dbuchanan | last post by:
When there are only a few items in the CheckBoxList they are distributed in a sparse maner such as one at top, one in the middle and one at the bottom. Is there any way to have the vertical...
0
6991
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...
0
7160
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,...
1
6878
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
7373
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
3088
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...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1405
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 ...
1
649
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
286
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...

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.