473,468 Members | 1,469 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problem with HTML tables

I'm trying to make a 4 x 13 table in html, but it won't format
correctly... maybe someone can see what I'm doing wrong.

<table border="1">
<tr>
<td colspan="3" rowspan="5">Cell 1, 1</td>
<td rowspan="4">Cell 1, 4</td>
</tr>
<tr>
<td>Cell 5, 4</td>
</tr>
<tr>
<td colspan="3">Cell 6, 1</td>
<td rowspan="8">Cell 6, 4</td>
</tr>
<tr>
<td>Cell 7, 1</td>
<td>Cell 7, 2</td>
<td>Cell 7, 3</td>
</tr>
<tr>
<td>Cell 8, 1</td>
<td>Cell 8, 2</td>
<td>Cell 8, 3</td>
</tr>
<tr>
<td>Cell 9, 1</td>
<td>Cell 9, 2</td>
<td>Cell 9, 3</td>
</tr>
<tr>
<td>Cell 10, 1</td>
<td>Cell 10, 2</td>
<td>Cell 10, 3</td>
</tr>
<tr>
<td>Cell 11, 1</td>
<td>Cell 11, 2</td>
<td>Cell 11, 3</td>
</tr>
<tr>
<td colspan="2">Cell 12, 1</td>
<td>Cell 12, 3</td>
</tr>
<tr>
<td colspan="2">Cell 13, 1</td>
<td>Cell 13, 3</td>
</tr>
</table>

Cell 5, 4 ends up in Row 1 next to Cell 1, 4 (it should be beneath 1,
4).

If anybody could help me find the bug here, I'd greatly appreciate it.

Nov 10 '06 #1
3 1791
On 2006-11-10, Phil <ph*******@gmail.comwrote:
I'm trying to make a 4 x 13 table in html, but it won't format
correctly... maybe someone can see what I'm doing wrong.

<table border="1">
<tr>
<td colspan="3" rowspan="5">Cell 1, 1</td>
<td rowspan="4">Cell 1, 4</td>
</tr>
<tr>
<td>Cell 5, 4</td>
</tr>
<tr>
<td colspan="3">Cell 6, 1</td>
<td rowspan="8">Cell 6, 4</td>
</tr>
<tr>
<td>Cell 7, 1</td>
<td>Cell 7, 2</td>
<td>Cell 7, 3</td>
</tr>
<tr>
<td>Cell 8, 1</td>
<td>Cell 8, 2</td>
<td>Cell 8, 3</td>
</tr>
<tr>
<td>Cell 9, 1</td>
<td>Cell 9, 2</td>
<td>Cell 9, 3</td>
</tr>
<tr>
<td>Cell 10, 1</td>
<td>Cell 10, 2</td>
<td>Cell 10, 3</td>
</tr>
<tr>
<td>Cell 11, 1</td>
<td>Cell 11, 2</td>
<td>Cell 11, 3</td>
</tr>
<tr>
<td colspan="2">Cell 12, 1</td>
<td>Cell 12, 3</td>
</tr>
<tr>
<td colspan="2">Cell 13, 1</td>
<td>Cell 13, 3</td>
</tr>
</table>

Cell 5, 4 ends up in Row 1 next to Cell 1, 4 (it should be beneath 1,
4).

If anybody could help me find the bug here, I'd greatly appreciate it.
The first row contains two cells and spans four columns altogether. It
also spans at least four rows.

The second row contains one cell ("Cell 5,4"). It can't start at the
left edge of its row because there's a rowspanning cell in the way
("Cell 1,1") so it goes as far right as it needs to. This takes it to
column 5 (starting at 1). The "rows" above it don't contain anything,
and therefore have zero height, so "Cell 5,4" appears at the top. There
is a small gap above it if you look closely corresponding to
border-spacing around the non-existent cell in the empty row above it.

I think it will be easier if you put empty <td></td>s in your table
everywhere there are "gaps" so that each <trends up with the same
number of explicitly spanned columns and rows. In other words, if the
width is 13, and you have one cell with a colspan of 3 and another with
a colspan of 6, add four more empty <td>s in that row. Or just one with
a colspan of 4 if you like. Pad out the columns in a similar fashion.

You can control visibility of the empty cells with the empty-cells CSS
property.

This way the mapping between your HTML and the grid that the UA works
out for the table stays much simpler and therefore easier to control.
Nov 10 '06 #2
Actually, this table should be 4 columns wide and 13 rows high and I
just realized my mistake. I needed some empty row containers (tr) in
there. Thanks for the help.

This is what it looks like in the end...

<table border="1">
<tr>
<td colspan="3" rowspan="5">Cell 1, 1</td>
<td rowspan="4">Cell 1, 4</td>
</tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr>
<td>Cell 5, 4</td>
</tr>
<tr>
<td colspan="3">Cell 6, 1</td>
<td rowspan="8">Cell 6, 4</td>
</tr>
<tr>
<td>Cell 7, 1</td>
<td>Cell 7, 2</td>
<td>Cell 7, 3</td>
</tr>
<tr>
<td>Cell 8, 1</td>
<td>Cell 8, 2</td>
<td>Cell 8, 3</td>
</tr>
<tr>
<td>Cell 9, 1</td>
<td>Cell 9, 2</td>
<td>Cell 9, 3</td>
</tr>
<tr>
<td>Cell 10, 1</td>
<td>Cell 10, 2</td>
<td>Cell 10, 3</td>
</tr>
<tr>
<td>Cell 11, 1</td>
<td>Cell 11, 2</td>
<td>Cell 11, 3</td>
</tr>
<tr>
<td colspan="2">Cell 12, 1</td>
<td>Cell 12, 3</td>
</tr>
<tr>
<td colspan="2">Cell 13, 1</td>
<td>Cell 13, 3</td>
</tr>
</table>
Ben C wrote:
On 2006-11-10, Phil <ph*******@gmail.comwrote:
I'm trying to make a 4 x 13 table in html, but it won't format
correctly... maybe someone can see what I'm doing wrong.

<table border="1">
<tr>
<td colspan="3" rowspan="5">Cell 1, 1</td>
<td rowspan="4">Cell 1, 4</td>
</tr>
<tr>
<td>Cell 5, 4</td>
</tr>
<tr>
<td colspan="3">Cell 6, 1</td>
<td rowspan="8">Cell 6, 4</td>
</tr>
<tr>
<td>Cell 7, 1</td>
<td>Cell 7, 2</td>
<td>Cell 7, 3</td>
</tr>
<tr>
<td>Cell 8, 1</td>
<td>Cell 8, 2</td>
<td>Cell 8, 3</td>
</tr>
<tr>
<td>Cell 9, 1</td>
<td>Cell 9, 2</td>
<td>Cell 9, 3</td>
</tr>
<tr>
<td>Cell 10, 1</td>
<td>Cell 10, 2</td>
<td>Cell 10, 3</td>
</tr>
<tr>
<td>Cell 11, 1</td>
<td>Cell 11, 2</td>
<td>Cell 11, 3</td>
</tr>
<tr>
<td colspan="2">Cell 12, 1</td>
<td>Cell 12, 3</td>
</tr>
<tr>
<td colspan="2">Cell 13, 1</td>
<td>Cell 13, 3</td>
</tr>
</table>

Cell 5, 4 ends up in Row 1 next to Cell 1, 4 (it should be beneath 1,
4).

If anybody could help me find the bug here, I'd greatly appreciate it.

The first row contains two cells and spans four columns altogether. It
also spans at least four rows.

The second row contains one cell ("Cell 5,4"). It can't start at the
left edge of its row because there's a rowspanning cell in the way
("Cell 1,1") so it goes as far right as it needs to. This takes it to
column 5 (starting at 1). The "rows" above it don't contain anything,
and therefore have zero height, so "Cell 5,4" appears at the top. There
is a small gap above it if you look closely corresponding to
border-spacing around the non-existent cell in the empty row above it.

I think it will be easier if you put empty <td></td>s in your table
everywhere there are "gaps" so that each <trends up with the same
number of explicitly spanned columns and rows. In other words, if the
width is 13, and you have one cell with a colspan of 3 and another with
a colspan of 6, add four more empty <td>s in that row. Or just one with
a colspan of 4 if you like. Pad out the columns in a similar fashion.

You can control visibility of the empty cells with the empty-cells CSS
property.

This way the mapping between your HTML and the grid that the UA works
out for the table stays much simpler and therefore easier to control.
Nov 11 '06 #3
On 10 Nov 2006 16:29:53 -0800, "Phil" <ph*******@gmail.comwrote:
>Actually, this table should be 4 columns wide and 13 rows high and I
just realized my mistake. I needed some empty row containers (tr) in
there. Thanks for the help.

This is what it looks like in the end...

<tr>
<td colspan="3" rowspan="5">Cell 1, 1</td>
<td rowspan="4">Cell 1, 4</td>
</tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr>
<td>Cell 5, 4</td>
</tr>
The above is equivalent to:

<tr>
<td colspan="3" rowspan="2">Cell 1, 1</td>
<td>Cell 1, 4</td>
</tr>
<tr>
<td>Cell 5, 4</td>
</tr>

If this is actually appropriate use of tables (is it?) then I'd expect
to see a few TH's in there as well.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Nov 11 '06 #4

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

Similar topics

1
by: The Pistoleer | last post by:
I have an inconsistent problem with some Internet pages when using Netscape (7.1) that I cannot reproduce with IE nor locally. Below is an example link. There are several tables on the pages. ...
9
by: Theodore A. Jencks | last post by:
Hi All, I have a problem that is two fold. First a little about the enviroment I'm using; I am running Microsoft Windows XP with all security patches applied. I use Mozilla 1.6 for all testing...
18
by: David Morris | last post by:
G'day. Is there a known "display:block;" problem in opera? In playing around trying to get some cross browser conformance, I either inadvertently or redundantly (depending on your perspective)...
15
by: Tamblyne | last post by:
This problem has got to have a simple solution and I can't be the first person who has ever handled it. Perhaps Google is no help because I'm not using the right terms? (I did find one post...
2
by: Robert McGregor | last post by:
Hi all, I've got a Front End / Back End database that was working just fine. One day i opened the FE to find that if I tried to open one of the linked tables from the database window, nothing...
1
by: bidllc | last post by:
I'm working on a minor bug from an open source bug tracking system (bugtracket.net). It's a great app, but I don't want to bother the creator any more than I have to, so I thought I'd pose the...
1
by: Joseph Scoccimaro | last post by:
I am currently working on a project for school dealing with accessing the DOM. I am trying to get access to inner tables that are nested with in other tables. Currently I am able to get all...
0
by: uncensored | last post by:
Hello everyone, I'm fairly new at .Net and I have a repeater inside a repeater problem. I will attach my code to this message but basically what I am able to tell when I run my page it tells me...
0
by: rupalirane07 | last post by:
Both grids displays fine. But the problem is only parent datagrid sorting works fine but when i clik on child datagrid for sorting it gives me error: NullReferenceException error Any...
0
by: cmrhema | last post by:
Hi, I have two controls one html select control and one asp.net dropdownlist control. In html select control i have three maps loaded. It is loaded in the following manner. <SELECT...
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:
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
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
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.