Click here to get back home

separate tables with common column widths

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
separate tables with common column widths Markus Ernst 09-01-2006
Get Chitika Premium
Posted by Markus Ernst on September 1, 2006, 4:40 am
Please log in for more thread options


Hi

Looking for a possibility to get separate tables rendered with common
column widths, I was surprised to see that this code validates:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head><title>Table test</title></head>
<body>
<table>
<!-- The first table -->
<tr>
<td colspan="3"><h2>Table 1</h2></td>
</tr>
<tr>
<th id="t1_name">Name</th>
<th id="t1_info">Info</th>
<th id="t1_price">Price</th>
</tr>
<tr>
<td headers="t1_name">Item name</td>
<td headers="t1_info">Some info about this item</td>
<td headers="t1_price">10.30</td>
</tr>
<!-- The second table -->
<tr>
<td colspan="3"><h2>Table 2</h2></td>
</tr>
<tr>
<th id="t2_name">Name</th>
<th id="t2_info">Info</th>
<th id="t2_price">Price</th>
</tr>
<tr>
<td headers="t2_name">Other item name</td>
<td headers="t2_info">Some info about this other item</td>
<td headers="t2_price">1255.80</td>
</tr>
</table>
</body>

So separate tables are combined in one, each starting with its own row
of <th>s. Is this ok, or are there any flaws in it, i.e. regarding
accessibility?

Thanks for a comment
Markus

Posted by Andy Dingley on September 1, 2006, 5:04 am
Please log in for more thread options



Markus Ernst wrote:

> I was surprised to see that this code validates:

Why surprised? <th> indicates that a _cell_ has some notion of
"header" attached to it, but it never indicated that they were to be
grouped at the top of the table. Look at the DTD, they're
interchangeable with <td>

<!ELEMENT (TH|TD) - O (%flow;)* -- table header cell, table data
cell-->


If you want an element that means "The one and only header bar applied
to this table, at the top of the table and not appearing in the body",
then you should use <thead>

http://www.w3.org/TR/html4/struct/tables.html#edef-TH


> So separate tables are combined in one, each starting with its own row
> of <th>s.

No, that's one single table, with a second row of <th> appearing in the
middle of it. Perfectly valid, and good coding practice, if it's
otherwise appropriate to be using <table>s like this.


Posted by Markus Ernst on September 5, 2006, 4:19 am
Please log in for more thread options


Andy Dingley schrieb:
>
> No, that's one single table, with a second row of <th> appearing in the
> middle of it. Perfectly valid, and good coding practice, if it's
> otherwise appropriate to be using <table>s like this.
>
Thank you, I am happy to read this!

Markus

Posted by David E. Ross on September 1, 2006, 3:55 pm
Please log in for more thread options


Markus Ernst wrote:
> Hi
>
> Looking for a possibility to get separate tables rendered with common
> column widths, I was surprised to see that this code validates:
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd">
> <html>
> <head><title>Table test</title></head>
> <body>
> <table>
> <!-- The first table -->
> <tr>
> <td colspan="3"><h2>Table 1</h2></td>
> </tr>
> <tr>
> <th id="t1_name">Name</th>
> <th id="t1_info">Info</th>
> <th id="t1_price">Price</th>
> </tr>
> <tr>
> <td headers="t1_name">Item name</td>
> <td headers="t1_info">Some info about this item</td>
> <td headers="t1_price">10.30</td>
> </tr>
> <!-- The second table -->
> <tr>
> <td colspan="3"><h2>Table 2</h2></td>
> </tr>
> <tr>
> <th id="t2_name">Name</th>
> <th id="t2_info">Info</th>
> <th id="t2_price">Price</th>
> </tr>
> <tr>
> <td headers="t2_name">Other item name</td>
> <td headers="t2_info">Some info about this other item</td>
> <td headers="t2_price">1255.80</td>
> </tr>
> </table>
> </body>
>
> So separate tables are combined in one, each starting with its own row
> of <th>s. Is this ok, or are there any flaws in it, i.e. regarding
> accessibility?
>
> Thanks for a comment
> Markus

Use CSS to define the column widths.

--

David E. Ross
<http://www.rossde.com/>

Concerned about someone (e.g., Pres. Bush) snooping
into your E-mail? Use PGP.
See my <http://www.rossde.com/PGP/>

Posted by Markus Ernst on September 5, 2006, 4:25 am
Please log in for more thread options


David E. Ross schrieb:
> Markus Ernst wrote:
>
>> Looking for a possibility to get separate tables rendered with common
>> column widths, I was surprised to see that this code validates:
[...]
>
> Use CSS to define the column widths.

I want to avoid pre-defining column widths, as this will prevent the
columns from adapting to the amount of text they contain (this is not
predictable in that application).

Thanks for your input anyway!

Markus

Similar ThreadsPosted
Three column layout, middle column clear:both; affects other two columns;no tables March 9, 2007, 11:31 pm
Best way for Common Template? CSS, Frames? September 9, 2005, 5:54 am
How do you line up separate fields in a select box? May 3, 2006, 10:12 am
Implied width of implied center column in 3 column table June 30, 2008, 4:23 am
How to separate a html text in order to print them in individual pages? January 28, 2005, 4:28 am
How to separate a html text in order to print each part in individual pages? January 28, 2005, 4:30 am
Table widths problem October 6, 2004, 11:40 pm
Nix the Mix! of percent and unit widths June 1, 2005, 12:24 pm
how to: a dynamic td width between static td widths? February 7, 2005, 3:08 pm
IE changes cell widths upon JavaScript insertion?? December 18, 2005, 2:11 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap