473,406 Members | 2,847 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,406 software developers and data experts.

table inside div block - no joy

I created an experimental page at:
http://sunbeam.rahul.net/~unicorn/csstest.html
....which is a standard header + nav bar + 2-column content + footer
CSS layout.

The left column is 10em wide and contains two block elements:

1. The first block element contains a small table wider than 10em.
Yes, I know this particular example doesn't truly need a table.
Let's assume it does, that I actually have tabular data to display
there.

2. The second block element contains a list of links.

This layout gives me inconsistent behavior in various browsers:

IE:
Box 1 automatically adjusts its width to contain the table, but
the other elements contained inside that box don't get wider, they
inherit 10em and don't change. Box 2 remains at 10em. The text in
the right column wraps around the wider part of the left column.

Opera, Firefox:
These browsers keep the left column at 10em. However, the block
elements DON'T contain the table properly; instead, the table pokes
out the right side. The text in the right column is not wrapped
around the table intruding into it.

How would I get such a layout to display consistently across browser
platforms, without using fixed-pixel sizes everywhere?

(Before anyone asks why it's HTML 4.01 Transitional instead of
strict, it's because this is part of re-doing a table-heavy site
that uses numerous table attributes [such as nowrap] that are legal
in Transitional but not strict. Even the layout is table-based,
which I'm trying to change. In any case, I don't think it would
matter for the posted problem.)

-A
Apr 2 '06 #1
3 5194
axlq wrote:
I created an experimental page at:
http://sunbeam.rahul.net/~unicorn/csstest.html
...which is a standard header + nav bar + 2-column content + footer
CSS layout.

The left column is 10em wide and contains two block elements:
[...]
This layout gives me inconsistent behavior in various browsers:

IE incorrectly expands a div with a fixed width to fit its content.
To get what you want:
1. Remove #leftpanel { width:10em }
2. Remove <table width="100%">
3. Remove <hr width="80%">. Use a border property to put a line there,
say, for the <p> element that should contain "Admin Login."

Other notes:
- "<div class="invert"><b>Member Login</b></div>" is a heading. So use a
heading element (probably <h2>). Same for "Tour our website," "Resources,"
"Search Content," "View Content," etc.
- Body text is set to 83.33%, 16.66% smaller than I prefer.
- You use <br> where <p> is more semantically correct.
- Use ems to set the width of the <input> element. The width is much more
consistent across browsers that way. A gotcha is that the rule should be
applied as specifically as possible otherwise it applies to radio buttons,
check boxes, etc., as well.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Apr 3 '06 #2
Jim Moe wrote:
1. Remove #leftpanel { width:10em }
2. Remove <table width="100%">
3. Remove <hr width="80%">.

Crud. I was not clear.
1. remove the rule "width:10em"
2. remove the property width="100%"
3. remove the element <hr> completely.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Apr 4 '06 #3
In article <9t********************@giganews.com>,
Jim Moe <jm***************@sohnen-moe.com> wrote:
Jim Moe wrote:
1. Remove #leftpanel { width:10em }
2. Remove <table width="100%">
3. Remove <hr width="80%">.

That resulted in very odd behavior in IE, but normal behavior in Firefox
and Opera. The <hr width="80%"> expanded to 80% of the viewport in IE.
In the other browsers it expanded to 80% of whatever size the div block
needed to be to fit the text.
Crud. I was not clear.
1. remove the rule "width:10em"
2. remove the property width="100%"
3. remove the element <hr> completely.


THAT worked quite well! Thanks.

-A
Apr 4 '06 #4

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

Similar topics

8
by: F. Da Costa | last post by:
Following is a snippet of html in which I hide a whole table and try to hide a single row. Here is my question (plz don't chew my head off if its css related instead): Why does the divTable...
2
by: Knoxy | last post by:
Hello, I've noticed one or two people post on this before but nobody seems to have replied so raising the issue again... is this a known IE6 CSS bug? I have placed the following in my...
0
by: Les Juby | last post by:
I'm trying to print a simple catalogue of products but where an image straddles a page break, the image either disappears completely or else the first half prints at the bottom of the page but the...
5
by: Greg N. | last post by:
Hi folks, I have a table cell with a background image, something like <td background=landscape.jpg height=200></td> The sole purpose of this code is to display the image inside that table...
5
by: Uwe C. Schroeder | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, maybe my mind is stuck, but here's something strange. This is the classic "counter" thing, where you can't / won't use sequences....
117
by: phil-news-nospam | last post by:
Is there really any advantage to using DIV elements with float style properies, vs. the old method of TABLE and TR and TD? I'm finding that by using DIV, it still involves the same number of...
7
by: Allie | last post by:
Here's an example of what I'm trying to do: <table> <tr style="text-align:left; font-size:10pt; font-weight:bold"> <!-- I want this word to align to the left --> ' ||CRPT|| ' <!-- I want this...
5
by: Test | last post by:
Is it possibel to have DIV's inside a table cell so that their position can be given relative to top left corner of the cell. Now the DIVs seem to position themselves relative to previous object.
8
by: webster5u | last post by:
Hi, I'm encounter a problem here. I hope somebody able helping me. i'm put a "log out" hyperlink overlap a image and that particular image is inside a table cell. I also try align the hyperlink on...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
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...

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.