tech support 8

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Monday, 16 July 2012

It's OK to Use Tables

Posted on 13:13 by Unknown


Image of Baby Boomerangutuang.

Baby Boomerangutuang, one of the Tick's students.




If you cut your teeth building for the web in the 90s and even into the 00s, then you probably learned to lay out your HTML pages using tables. As CSS support and techniques have caught up, tabled layouts have mostly gone the way of the font element.




There seems to be such a strong backlash against tables, however, that many developers won't even use them when it is both semantically and structurally appropriate — such as marking up tabular data.




The W3C HTML5 draft specification has a pretty simple way to qualify if a table is appropriate:





The table element represents data with more than one dimension, in the form of a table.





To explain it another way, if you are representing columns and rows of data then you probably should be using a table. If you find you are using images or other elements, then you are likely doing it wrong.




In addition, representing tabular data using other elements means you may be preventing users of assistive software, who already have experience reading tables, from being able to access the information in the same way.




Examples of the two methods I see most frequently to incorrectly mark up tables follow.



Tables As Images













These screen shots show how each table appeared when viewed on an iPad and on an Android Evo using Opera. Click/tap for larger images.




In February .net Magazine posted an article, Deliver video seamlessly to desktop and mobile devices, which included two tables of browser and video codec support. These two tables were not marked up using a table, however.




Instead the tables were presented as images with no useful alt text. While the article used an HTML5 figure, there was nothing to present the contents of the tables as plain text.




The problem was exacerbated by the fact that when the page was viewed on mobile devices, the automatic down-sampling of the .net Magazine CMS (I am assuming here) for the mobile version of the article resulted in images that were completely illegible. A traditional HTML table would not have suffered from that problem.




I figured I was on to something when my tweet drew some comments, though I don't agree that it's just bad alt text:



@aardrian they could have easily made the same mistake without HTML5, and likely would have. That's just bad alt text :) /cc @rogerjohansson

— Derek Featherstone (@feather) February 10, 2012






To .net Magazine and the author's credit, the images were replaced on both the main site and the mobile site within about 18 days of me mentioning it (which you can follow in the comments).





Tables As Any Other Element









This screen shot shows the event schedule when viewed in a desktop browser. Click/tap for a larger image.




I suspect some tables are put together using other HTML elements just to show off that the developer can do it. After all, If developers were thinking about the structural and semantic meaning of the content, then they surely wouldn't use div and spans to mark up tabular data.




The web site for a two day responsive web design workshop, Build Responsively, includes a schedule on its Columbus event page. This schedule includes a column of times and a column of sessions. Each column has a heading and the rows have alternating background styles. In every visual sense, it's a table of data.




Semantically and structurally, however, that's not how it's coded (which I discovered when I attempted to print the page). It's a series of divs and spans inside an ordered list (I have also seen this done with definition lists). The first bullet even has the class "heading," which is probably a good clue that this entire list could be a table and that "heading" could be a th.




This code block shows the event schedule HTML for context:



      <ol>
<li class="heading">
<div class="time">Time</div>
<div class="session">Session</div>
</li>

<li>
<div class="time">
<time datetime="2012-07-09 08:00">8:00AM</time> - <time datetime="2012-07-09 09:00">9:00AM</time>
</div>
<span class="session">Registration, Coffee</span>
</li>

<li>
<div class="time">
<time datetime="2012-07-09 09:00">9:00AM</time> - <time datetime="2012-07-09 09:40">9:40AM</time>
</div>
<span class="session">Responsive Web Design, 101</span>
</li>

<li>
<div class="time">
<time datetime="2012-07-09 09:45">9:45AM</time> - <time datetime="2012-07-09 11:15">11:15AM</time>
</div>
<span class="session">Responsive Planning &amp; Design</span>
</li>

<li>
<div class="time">
<time datetime="2012-07-09 11:30">11:30AM</time> - <time datetime="2012-07-09 12:00">Noon</time>
</div>
<span class="session">Getting a Good Start</span>
</li>

<li>
<div class="time">
<time datetime="2012-07-09 12:00">Noon</time> - <time datetime="2012-07-09 13:00">1:00PM</time>
</div>
<span class="session">Lunch (provided)</span>
</li>

<li>
<div class="time">
<time datetime="2012-07-09 13:15">1:15PM</time> - <time datetime="2012-07-09 17:00">5:00PM</time>
</div>
<span class="session">Afternoon Session, The Nitty Gritty</span>
</li>

<li>
<div class="time">
<time datetime="2012-07-09 17:30">5:30PM</time> - <time datetime="2012-07-09 22:00">?</time>
</div>
<span class="session">Opening Night Party, Sponsored by GitHub!</span>
</li>
</ol>




You can see this site featured on PrintShame.



What You Can Do




With all the push for hand-crafted HTML and CSS and the strong desire to show off what developers can do using HTML5 and assorted tricks, take a look at any grids you find yourself marking up. If you find you have columns of data, rows of data, headings for rows or columns, or are using any CSS table display properties, then you just might need to use a table instead.



Update: January 3, 2012




The article HTML5 caption element and headings explains that with HTML5's acceptance of headings in captions on tables, it's now possible for your data tables to fit into the heading navigation when accessed via a screen reader.



Update: April 12, 2013




Léonie Watson has put together a quick overview on how to make your data tables accessible over at .net Magazine.



Update: October 21, 2013




Another example of doing it wrong, found in the wild:



No! This is *NOT* the way to build a responsive table. Poor semantics, no accessibility: http://t.co/gpRgpEFMge

— Russ (@russmaxdesign) October 21, 2013

Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in accessibility, css, rant, standards | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Social Media Day 2011 in Buffalo #smdayBUF
    Last night marked the second Mashable-sponsored Social Media Day here in Buffalo. With 154 RSVPs for the event, the venue, The Eights Bist...
  • Web Accessibility Sorta-Infographic
    WebAIM is a non-profit organization within the Center for Persons with Disabilities at Utah State University. It has a reputation (perhaps o...
  • Now the Mobile Web Is Dead?
    It was barely two years ago that I scoffed when Wired declared the web dead ( Enough about the Death of the Web ). Fast forward to today and...
  • Browser Performance Chart
    Jacob Gube has posted a handy chart over at Six Revisions titled " Performance Comparison of Major Web Browsers ." He tests the c...
  • Facebook, HTML5, and Mis-Reporting
    My Twitter stream and the headlines of sites across the web yesterday lit up with Facebook's CEO blaming its stock price (failure to mee...
  • The Science of Trust in Social Media
    I am one of those people who always needs to see proof of some assertion, evidence to back up a claim. While I can accept anecdotal evidence...
  • ICANN Moves .org Away from VeriSign
    This Saturday, the .org top-level domain (TLD) will no longer be privately managed. With VeriSign's contract with ICANN for management ...
  • Speaking at Mom 2.0 in Houston, TX
    I will be in Houston this week to speak at the Mom 2.0 Summit (Feb. 18-20, 2010, Houston, TX). To make it a little easier to describe, here...
  • Algonquin Studios Gets Local Press
    I'm taking an opportunity to brag a little about my company, Algonquin Studios , being featured today in the Business section of our lo...
  • App Store Meta Tags
    Why yes, Dominos, I'd love to tap again to get your real home page to order a pizza when I could have done it right here, below your ove...

Categories

  • accessibility
  • Adobe
  • analytics
  • Apple
  • apps
  • ARIA
  • Bing
  • Blink
  • Brightkite
  • browser
  • Buzz
  • Chrome
  • clients
  • css
  • design
  • Facebook
  • Firefox
  • Flash
  • fonts
  • food
  • Foursquare
  • g11n
  • geolocation
  • globalization
  • Google
  • Gowalla
  • html
  • i18n
  • ICANN
  • infographic
  • Instagram
  • internationalization
  • internet
  • Internet Explorer
  • JavaScript
  • JAWS
  • Klout
  • L10n
  • law
  • localization
  • Lynx
  • Mapquest
  • Microsoft
  • mobile
  • Netscape
  • ning
  • Opera
  • patents
  • picplz
  • Plus
  • print
  • privacy
  • project management
  • QR
  • rant
  • RSS
  • Safari
  • SCVNGR
  • search
  • SEM
  • SEO
  • social media
  • Sony
  • speaking
  • standards
  • SVG
  • touch
  • translation
  • Twitter
  • typefaces
  • usability
  • UX
  • Verizon
  • video
  • W3C
  • WAI
  • WCAG
  • WebKit
  • whatwg
  • Wired
  • WOFF
  • xhtml
  • Yahoo
  • YouTube

Blog Archive

  • ►  2013 (39)
    • ►  December (1)
    • ►  November (7)
    • ►  September (4)
    • ►  July (3)
    • ►  June (2)
    • ►  May (5)
    • ►  April (3)
    • ►  March (6)
    • ►  February (2)
    • ►  January (6)
  • ▼  2012 (63)
    • ►  December (2)
    • ►  November (4)
    • ►  October (5)
    • ►  September (5)
    • ►  August (4)
    • ▼  July (6)
      • My Print Styles Article in .net Magazine
      • It's OK to Use Tables
      • Codepen Has Handy Sharing Tools for Devs
      • Let's Treat Old Browser Users Better
      • Changes to jQuery Browser Support
      • Social Media Day 2012 in Buffalo #smdayBUF
    • ►  June (7)
    • ►  May (7)
    • ►  April (8)
    • ►  March (5)
    • ►  February (3)
    • ►  January (7)
  • ►  2011 (67)
    • ►  December (5)
    • ►  November (7)
    • ►  October (5)
    • ►  September (4)
    • ►  August (8)
    • ►  July (3)
    • ►  June (8)
    • ►  May (3)
    • ►  April (1)
    • ►  March (6)
    • ►  February (6)
    • ►  January (11)
  • ►  2010 (100)
    • ►  December (8)
    • ►  November (7)
    • ►  October (5)
    • ►  September (10)
    • ►  August (7)
    • ►  July (11)
    • ►  June (12)
    • ►  May (6)
    • ►  April (8)
    • ►  March (10)
    • ►  February (5)
    • ►  January (11)
  • ►  2009 (51)
    • ►  December (9)
    • ►  November (6)
    • ►  October (21)
    • ►  September (13)
    • ►  August (2)
  • ►  2003 (3)
    • ►  October (1)
    • ►  January (2)
  • ►  2002 (9)
    • ►  December (1)
    • ►  June (3)
    • ►  April (1)
    • ►  March (3)
    • ►  January (1)
  • ►  2001 (1)
    • ►  February (1)
  • ►  2000 (4)
    • ►  October (1)
    • ►  July (1)
    • ►  June (1)
    • ►  January (1)
  • ►  1999 (7)
    • ►  November (1)
    • ►  September (2)
    • ►  August (2)
    • ►  July (1)
    • ►  June (1)
Powered by Blogger.

About Me

Unknown
View my complete profile