473,396 Members | 2,052 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.

<tables> in <divs> - humiliating question

Hello,

Embarrassing as it is, I'm stumped by a (I'd imagine) fairly
elementary CSS problem.

Consider the code below. We have a table with three columns, two of
which are set to a width of 150px. The center cell has no specific
width and therefore grows/shrinks as the browser window is re-sized.

In the center cell is a <div>, set to display with the properties set
in #main.

Inside that <div> is another table (the number of rows and columns are
immaterial, I guess) set to 100% width, so that it too appears to
grow/shrink depending on the size of the browser window.

In I.E. 6.something on my Windows machine, the code below results in
the innermost table overlapping (or under-lapping by the looks of it)
with the right-hand column. If I set the width of #main to 100% rather
than auto, the problem seems to go away, but then appears in I.E.
5.something on my Macintosh.

Does anyone have any ideas on how to make this work reliably
cross-browser/platform? How obvious is the thing I'm missing?

Thanks,

Mark

<html>
<head>
<style type="text/css">
<!--
#main {
margin: 10px;
background-color: #99CC00;
padding: 0px;
width: auto;
}
-->
</style>
</head>

<body>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150" bgcolor="#990000">&nbsp;</td>
<td><div id="main">
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</div></td>
<td width="150" bgcolor="#990000">&nbsp;</td>
</tr>
</table>

</body>
</html>
Jul 20 '05 #1
3 3869
In article <5b**************************@posting.google.com >, Mark
Bennett wrote:
Hello,

Embarrassing as it is, I'm stumped by a (I'd imagine) fairly
elementary CSS problem.
Yes, it seems like you are using tables to do something in which CSS is
much better.
Consider the code below. We have a table with three columns, two of
which are set to a width of 150px. The center cell has no specific
width and therefore grows/shrinks as the browser window is re-sized. In the center cell is a <div>, set to display with the properties set
in #main. Inside that <div> is another table (the number of rows and columns are
immaterial, I guess) set to 100% width, so that it too appears to
grow/shrink depending on the size of the browser window.
URL?
Does anyone have any ideas on how to make this work reliably
cross-browser/platform? How obvious is the thing I'm missing?


What are you trying to archive?
I can't believe you have tabular data that need such tables.

I can't see why you are using nested tables and divs.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

Jul 20 '05 #2
Mark Bennett wrote:
We have a table with three columns, two of which are set to a
width of 150px. The center cell has no specific width and
therefore grows/shrinks as the browser window is re-sized.

In the center cell is a <div>, set to display with the
properties set in #main.
Inside that <div> is another table (the number of rows and
columns are immaterial, I guess) set to 100% width, so that it
too appears to grow/shrink depending on the size of the browser
window.

But what's in these tables? Tabular data?
What are you trying to archive? I can't believe you have tabular
data that need such tables.


I need to make a fairly complicated table and would like to put it
inside a box with properties similar to the one in my example.
That is what I'm trying to achieve.


Algorithum expressed in the form of a flow chart[1]:

Are you trying to use tables for layout?
Yes -> http://www.allmyfaqs.com/faq.pl?Tableless_layouts
No -> Sure?
No -> http://www.allmyfaqs.com/faq.pl?Tableless_layouts
Yes -> Really? You are only using them to asociate
rows and cols of data?
No -> http://www.allmyfaqs.com/faq.pl?Tableless_layouts
Yes -> Give us a URL. Data that is so complex that it
makes sense to nest tables is really rare.
This is something special.
I don't have a URL to show you, nor do I need one; the example
illustrates my problem perfectly well.
Then how can we help you?
Do you know how to make the code in my example work reliably
cross-browser/platform?


Css for presentation. HTML for content.

[1] Not my idea; borrowed (with permission!) from ciwa* some months ago.

--
Brian
follow the directions in my address to email me

Jul 20 '05 #3
Mark, just change your style to

#main { margin: 0px; background-color: #99CC00; padding: 10px; width:
100%; }

Andrew.
http://terra-informatica.org
http://blocknote.net

<html>
<head>
<style type="text/css">
<!--
#main {
margin: 10px;
background-color: #99CC00;
padding: 0px;
width: auto;
}
-->
</style>
</head>

<body>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150" bgcolor="#990000">&nbsp;</td>
<td><div id="main">
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</div></td>
<td width="150" bgcolor="#990000">&nbsp;</td>
</tr>
</table>

</body>
</html>

Jul 20 '05 #4

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

Similar topics

3
by: Paul Thompson | last post by:
When I put a <div ...> inside a <table> specification, functionality is not there. When I put the <table> inside the <div> everything works. Why is that?
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...
61
by: Toby Austin | last post by:
I'm trying to replace <table>s with <div>s as much as possible. However, I can't figure out how to do the following… <table> <tr> <td valign="top" width="100%">some data that will...
6
by: matt cook | last post by:
I have having two problems with the <TD>, CSS, Firefox combination. I would greatly appreciate any information on fixing them. Firstly, none of the padding or margin values I apply to a <TD> have...
15
by: scott | last post by:
Hello, I'm working on updating some of my table-based sites to use CSS instead of tables. One of my sites has a header that is composed of three elements: A B C In my prior design, this was...
8
by: Gianni Rondinini | last post by:
hi all, i'm here again. i couldn't find/understand this on w3c css2 recommendation and documentation, then here i ask. i decided to still use some tables in my pages for some forms. i played...
13
by: Davo | last post by:
Hi Folks, There seems to be something about not using tables for layout, but use divs instead. I'm not sure if I've got this right. If the output looks like what you want, then it shouldn't...
24
by: Chris F.A. Johnson | last post by:
On 2008-07-09, Denis McMahon wrote: If the left-hand column contains any text, use em rather than px to size it. In CSS, less is more. Most problems are caused by specifying too much rather...
36
by: Roedy Green | last post by:
The only browser I have encountered that supports <colgroup><col class="behold"></colgroup> to apply a CSS style to a whole column, is Microsoft Internet Explorer. I have been told it SHOULD NOT...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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,...

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.