views:

120

answers:

1

What is the problem with <table> tag which is not with <div> for screen reader users? Please Explain with example.

+4  A: 

I guess because you can communicate a proper table via audio, but can not parse a table used for layout and speak it sensibly.

Example

Title | Age
Bob   | 6
Greg  | 10

This can be spoken.

But what about this?

[img] | Welcome to my site | [img]
News  | [img] 

How do you think that would be read to a visually impaired person?

It all comes down to semantics. A table used for layout purposes can't be parsed and read correctly (or reliably). A div is just a division in a page, not necessarily for layout. I don't think screen readers give any semantic meaning to a div when speaking a page's content.

Many sites still use tables for layout. I suspect it will become less and less as less CSS capable browsers decline in share (IE6 for one).

Also, certain government sites must be accessible to everyone. This is Section 508. Using tables for layout will probably violate this.

If you want to have an idea of what a screen reader may read, check out Fangs for Firefox (reference to the screen reader JAWS).

alex
IS it so, Screen reader speak about <table> bot not for <div>?
metal-gear-solid
@Jitendra: The screen reader will speak the *contents* of the div, but the fact of the div doesn't make the screen reader try to interpret those contents in a specific way. A table, on the other hand, has a *meaning* (a table of information), and the screen reader may try to use the fact that it's a table when speaking the contents to the user -- which may get it into trouble. Tables for layout are so common that I'd be surprised if any good screen reader actually had trouble with them, but why make life difficult if you can avoid it?
T.J. Crowder
@TJ I was surprised you deleted your answer, it was good.
alex
@TJ - you mean <DIV> doesn't have any semantic value while <table> has. Ok i wasn't know this
metal-gear-solid
<div> is a division in the page. But nothing in the spec says it should be used for any definitive purpose. I use it mainly as a hook for CSS and JavaScript, and to group related items together.
alex
Thanks @Alex and @TJ. I found good info about div here also http://en.wikipedia.org/wiki/Span_and_div
metal-gear-solid
@Alex: Thanks. I thought it didn't offer anything on top of yours, so when I saw yours, I removed mine and upvoted yours. But I think I may be in the minority on this, perhaps I should have just upvoted yours and left mine in place. It just seems silly to leave an arguably duplicate answer around... :-) But again, the more I see, the more it seems like I'm out of step on that, despite this: http://meta.stackoverflow.com/questions/15775/do-you-delete-your-own-answer-when-its-a-duplicate
T.J. Crowder
@TJ I delete a lot of my answers too, and then go back and read them and think *that wasn't so bad*. Generally I don't undelete them though.Thanks for the upvote. If you undelete yours, I'll vote it up.
alex