0

On the W3C page on HTML tables, there is a line, "Tables should not be used purely as a means to layout document content as this may present problems when rendering to non-visual media [such as screen readers]."

We can understand this requirement because screen readers have had to parse HTML content on the page and make sense of it. This makes sense as accessibility was not defined in the before times, in the long long ago. But now, we have accessibility tags which were created to describe the data to screen readers and ignore the layout.

If you defined accessibility on your web page would it matter if you are using tables or CSS?

Basically, I would like others to explain to me that, "...it is or is not OK to use tables or CSS or JavaScript or whatever to layout your content as long as you add accessibility tags".

I say layout the page with JavaScript because we are in the age of RIA and the page can be updated dynamically with JavaScript without refreshing (see WAI-ARIA).

WAI-RIA is the Accessible Rich Internet Applications Suite, defines a way to make Web content and Web applications more accessible to people with disabilities. It especially helps with dynamic content and advanced user interface controls developed with Ajax, HTML, JavaScript, and related technologies.).

Update
For the record, I should have mentioned this earlier, but I don't plan to use tables for layout. But mainly I wanted to know if I could. I wanted to know if the advancements we've made in accessibility made it possible to use tables willy nilly, if we wanted without repercussions.

I found this related post, which I think is different than my question but there are some good answers (though out of date and the topic is locked down).

TylerH
  • 20,799
  • 66
  • 75
  • 101
1.21 gigawatts
  • 16,517
  • 32
  • 123
  • 231
  • 1
    dude, for someone with such high rep, you should know this belongs in Meta Exchange or some other exchange site, not StackOverflow – MilkyTech May 30 '14 at 15:41
  • @ChrisM - looking up Meta Exchange now – 1.21 gigawatts May 30 '14 at 15:42
  • 1
    @ChrisM - OK. No, this is about using tables in general web design not the stack overflow site. :) – 1.21 gigawatts May 30 '14 at 15:44
  • meta might not be the right exchange site but this certainly is not. [**READ THIS**](http://stackoverflow.com/help/dont-ask). btw-I didn't downvote you. – MilkyTech May 30 '14 at 15:48
  • Thanks for not down voting me. I think this fits under, "I would like others to explain ______ to me” why I should or should not code in this manner. I might reword a few things. Thanks. – 1.21 gigawatts May 30 '14 at 15:59
  • Like PeteAUK said, you will get a lot of opinions, that is exactly why its not a good question. doesn't have a definitive answer, just opinions. [**READ THIS**](http://blog.stackoverflow.com/2011/01/real-questions-have-answers/) – MilkyTech May 30 '14 at 16:08
  • 4
    If you really absolutely positively uncontentiously compulsorily **must** use a table for layout, [the HTML5 spec simply asks that you mark it with `role="presentation"`](http://www.w3.org/TR/html5/tabular-data.html#tabular-data) so as not to confuse clients that expect tables to serve their actual purpose. This is as far as facts go; any other point of debate would be one of opinion. – BoltClock May 30 '14 at 16:17
  • 1
    If I were you, I would stop trying to find excuses to start using tables for layout again. There are quite a few modern CSS-based alternatives that you could use without having to second-guess your coding practices. – BoltClock May 30 '14 at 16:19
  • @BoltClock - Thanks. BTW there are legitimate cases to use tables for layout. HTML emails are one example. See Gmail. – 1.21 gigawatts May 30 '14 at 17:16
  • @1.21 gigawatts: Of course. You were referring to RIAs in your question however - I was addressing that bit. – BoltClock May 30 '14 at 17:19
  • @ChrisM - Well, the reason that people say to not use tables is because of accessibility reasons. That's because they did not exist. BUT NOW there are now accessibility options so is that their only reason? – 1.21 gigawatts May 30 '14 at 17:20
  • i didn't argue for or against tables for layout (althought i think its silly to use them). I think you meant @BoltClock – MilkyTech May 30 '14 at 17:57
  • @BoltClock - Right, I meant BoltClock. And for the record, and I should have said this earlier, but I don't plan to use tables for layout but wanted to know if I *could*. Catch my drift? Ya dig? :P – 1.21 gigawatts May 31 '14 at 00:48

2 Answers2

1

In short, it is (and has always been) possible to use tables for layout with little or no accessibility impact. However, you are making more work for yourself.

If you use a CSS layout with divs, sections, main etc. you only need to think about ARIA landmarks for accessibility.

If you use tables for layout, you have to consider nullifying the table roles, then adding HTML5 semantics and landmarks.

NB: ARIA is not intended to replace regular HTML semantics, it is intended to add semantics for applications that are not (yet) supported by HTML. Oh, and there are no "accessibility tags", but HTML does include tags that help with accessibility, and ARIA adds attributes that help describe functionality.

AlastairC
  • 3,277
  • 21
  • 15
0

Quite a good question and I'm sure you'll get a lot of opinions on it.

Personally (the way the standard currently is), tables should only be used for tabular data. You can use CSS to display as 'table', 'table-cell' etc, so could easily mimic this display method with div tags. But browsers expect data within a table rather than layout.

However, the one exception I would say is that e-mails should be laid out using tables :)

PeteAUK
  • 968
  • 6
  • 16
  • 1
    Thank you. I'm glad you get where I'm coming from. I forgot about emails! I think I read that Gmail does not let you use CSS so you have to use tables for HTML emails. – 1.21 gigawatts May 30 '14 at 15:46
  • 2
    Gmail is... odd. You can use CSS for plain tags, but not for classes. You can however use inline CSS from the style="" variable. – PeteAUK May 30 '14 at 15:55
  • 1
    On the other hand, if you want to easily middle center for I7 and lower, a whole page using a table with one **single cell** , it is not really a table anymore. not looking for trouble but saying that sometime thing are just compromised – G-Cyrillus May 30 '14 at 15:56