Home arrow HTML arrow Page 4 - HTML, CSS and Tables: The Beauty of Data
HTML

HTML, CSS and Tables: The Beauty of Data


Assistive technology gags when it encounters HTML tables coded by the old school methods. Using the new coding lets you make tables more accessible to your users, and it really isn't that much harder--just remember what a table really is. Chris Heilmann reminds us, and gives an introduction to CSS.

Author Info:
By: Chris Heilmann
Rating: 4 stars4 stars4 stars4 stars4 stars / 87
November 17, 2004
TABLE OF CONTENTS:
  1. · HTML, CSS and Tables: The Beauty of Data
  2. · What is a table?
  3. · W3C to the rescue
  4. · Summary needed
  5. · Styling tables: the days of the spacer GIF
  6. · Embracing CSS and separating "what is what" and "what it looks like"
  7. · Our CSS

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
HTML, CSS and Tables: The Beauty of Data - Summary needed
(Page 4 of 7 )

A fully accessible table also needs a summary. Furthermore it is helpful to add a caption and structure the table into a THEAD and TBODY and TFOOT:

<table summary="This table lists all the flights by XYZ Air leaving London today.">
  <caption>Flight Schedule</caption>
  <thead>
    <tr>

       <th scope="col">Flight Number:</th> 
      <th scope="col">From:</th> 
      <th scope="col">To:</th> 
      <th scope="col">Departure:</th> 
      <th scope="col">Arrival:</th> 
    </tr>

  </thead>
  <tfoot>
    <tr>
      <td colspan="5">Total: 3 flights</td>
    </tr>

  </tfoot>
  <tbody>
  <tr>
    <th scope="row">BA 3451</th>
    <td>Heathrow</td>

    <td>Nuremberg</td>
    <td>19:20</td>
    <td>19:50</td>
  </tr>

  <tr>
    <th scope="row">BA 1254</th>
    <td>Luton</td>
    <td>Alicante</td>

    <td>19:40</td>
    <td>20:50</td>
  </tr>
  <tr>
    <th scope="row">LH 331</th>

    <td>Heathrow</td>
    <td>Hamburg</td>
    <td>20:00</td>
    <td>20:20</td>

  </tr>
  </tbody>
</table>

The browser does not render all of these attributes, though:

Flight Schedule
Flight Number:From:To:Departure:Arrival:
Total: 3 flights
BA 3451HeathrowNuremberg19:2019:50
BA 1254LutonAlicante19:4020:50
LH 331HeathrowHamburg20:0020:20

Notice that TFOOT must appear immediately after THEAD and before the first TBODY.

Now that we have the HTML skeleton, let's paint it and turn it into something like this:

Example of a styled table


blog comments powered by Disqus
HTML ARTICLES

- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5
- BBC Adopts HTML 5, Mozilla Addresses Issues
- Advanced Sticky Footers in HTML and CSS
- HTML and CSS Sticky Footers
- Strategy Analytics Predicts HTML5 Phones to ...
- HTML5 Guidelines for Web Developers
- Learning HTML5 Game Programming
- More Engaging CSS3 and HTML Background Effec...
- Engaging HTML and CSS3 Background Effects
- More Web Columns with CSS3 and HTML
- Columns with CSS3 and HTML
- Creating Inline-Block HTML Elements with CSS
- Drag and Drop in HTML5: Parsing Local Files

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 10 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials