473,385 Members | 1,875 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,385 software developers and data experts.

separate tables with common column widths

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
Sep 1 '06 #1
4 4939

Markus Ernst wrote:
I was surprised to see that this code validates:
Why surprised? <thindicates 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 <thappearing in the
middle of it. Perfectly valid, and good coding practice, if it's
otherwise appropriate to be using <table>s like this.

Sep 1 '06 #2
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/>
Sep 1 '06 #3
Andy Dingley schrieb:
>
No, that's one single table, with a second row of <thappearing 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
Sep 5 '06 #4
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
Sep 5 '06 #5

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

Similar topics

1
by: Larry Rekow | last post by:
I have a report that's created each day as a flat textfile. Because I came from the Access world, I created a macro that imports it with a schema that gives meaningful names to the various...
44
by: Mariusz Jedrzejewski | last post by:
Hi, I'll be very grateful if somebody can explain me why my Opera 7.23 (runing under linux) doesn't show me inner tables. Using below code I can see only "inner table 1". There is no problem with...
4
by: milkyway | last post by:
Hello, I am trying to stop some behavior going on with a table. I have been using Visual Studio C# 2005. Basically, the table has certain column widths to start out with. When data is added...
5
by: nimdez | last post by:
Hi, I am working on an existing code base in which a lot of data displayed to the user is formatted in tables. Most tables are printed row-by-row using printf() with "%s" print conversion...
53
by: Alan Silver | last post by:
Hello, I understand the issue that tables should be used for tabular data and not for layout, but I would like some clarification as to exactly what constitutes tabular data. For example, if...
2
by: Griff | last post by:
I've a (classic) ASP web page that has several tables on it that have identical columns (headings). When these tables are displayed they of course have different widths, based upon the amount of...
3
by: LurfysMa | last post by:
I would like to hear opinions on the tradeoffs of putting the tables, forms, and queries for several related datasets in separate databases vs one combined database. I am working on an...
32
by: Simon Dean | last post by:
Duh... Not another one... Hopefully simple though, I hate the way *I* (and it might be a CSS trait) can't intermix fixed width divisional elements with a variable auto expanding div??? The...
24
by: =?ISO-8859-1?Q?Fran=E7ois_de_Dardel?= | last post by:
http://dardel.info/Eau.html What I wanted to achieve was not really complicated: essentially a left hand column with a 75% width, and a right hand column containing occasional right-flush picts,...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?

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.