View Full Version : Proper Table use
07-07-2007, 05:44 PM
ok in the past when using tables i have only used <table> <tr> and <td>
for wc3 complicence should i be using the other tags such as <th> are there any more tags?
You shouldn't be using tables at all for layout. For tabular data, say from a database, is fine. For layouts you should be using CSS and <div> tags - Though of course you didn't say you were suing them for layouts at all ;)
As far as I know, using th, thead and that is fine.
07-07-2007, 08:48 PM
If you are using tables, check out the "table tags" table near the bottom of this link - http://w3schools.com/html/html_tables.asp
Click on each tag to get more information about that tag, such as if it is or if parameters for it are depreciated in favor of CSS...
07-07-2007, 09:04 PM
There are a lot of table elements.
table: the table
caption: the table’s caption (title, brief description, or both); must occur before all other table elements
colgroup: allows you to semantically group columns and style them together; useful with scope="colgroup"; must occur before thead and after caption
col: allows you to style a column; theoretically, I think that you could also set the language of a column this way; can appear standalone or inside of colgroup elements
thead: groups of header cells above the table
tfoot: content below the table; a catch is that it must occur after any thead elements but before any tbody elements; this is the least used of all table elements
tbody: use these to group rows together; useful with scope="rowgroup"
tr: a table row
th: a table header cell; other table cells are associated with this type of table cell via use of scope, headers, and axis attributes
td: a table data cell; these contain the data that the table is meant to present
You can see a correctly marked up table: D0007 (http://www.jsgp.us/demos/D0007.html). I used a bit more code than was necessary though; the headers attributes were unnecessary except for the hover effect. The hover effect is still broken in Internet Explorer.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.