Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Mar 2006
    Thanked 0 Times in 0 Posts

    Proper Table use

    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?

  • #2
    Regular Coder BWiz's Avatar
    Join Date
    Mar 2006
    Sol System
    Thanked 21 Times in 21 Posts
    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.
    BWiz :: Happy Coding!
    2007 2008 2009
    2010 2011
    Irrational numbers make no sense.

  • #3
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Denver, Colorado USA
    Thanked 340 Times in 332 Posts
    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...
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #4
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Splendora, Texas, United States of America
    Thanked 292 Times in 286 Posts
    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. 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.
    Last edited by Arbitrator; 07-07-2007 at 10:09 PM. Reason: I corrected a formatting issue.
    For every complex problem, there is an answer that is clear, simple, and wrong.


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts