WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Making a grid of divs appear as a "table"


From: Christophe Strobbe
Date: Jun 19, 2008 4:00AM


At 00:27 19/06/2008, you wrote:
>Gareth writes: <<I'm a little unsure what you're trying to achieve
>below, however, one thing I will say is that if you have a wadge of
>tabular data to display, then use a table.>>
>Thank you all for the replies. I will post a demo of the working
>table as soon as I fix a bug.
>To recap, my the goal is to provide a FIXED HEADER, where the table
>body scrolls and the column headers appear to stay stationary as the
>data scrolls under it. It is simply impossible to do it without
>javascript, and cannot be done with a single table at all, as each
>browser treats "tbody" and overflow differently.

People have tried this before, but I lost the pointers to the demos
that I had found.
See for example:
* Non-scrolling table header:
* Pure CSS Scrollable Table with Fixed Header:
(found through Scrollable Table:
this one works in SeaMonkey 1.1, Firefox 1.5, Firefox,
Internet Explorer 6, Opera 9.02 on Windows XP;
* Scrolling HTML Table with Fixed Header:
(doesn't work in Opera 9.02: the header also scrolls);
I haven't tested the updated version at
* there's also a discussion thread at
where the code from www.imaputz.com is also discussed;
* and another thread at <http://csscreator.com/node/30243>;.

I hope this helps.

Best regards,


>So I have a solution that uses two tables (as several others on the
>web have tried, too). The top table contains the column headers,
>and the lower table functions as the primary data table.
>Now putting aside my quest for some better model (as that seems like
>a bad idea), I guess I should modify my question to ask: "How might
>I mark up this scheme properly?"
>To take a stab at my own question, it seems I should leave the top
>header table for sighted users, and duplicate the column headers in
>a hidden <th> row in the actual data table. That way, both needs
>are served, but the reader is seeing a fairly typical table.
>Here's my basic structure, showing both headers. Assuming this is
>the right approach, it's easy enough to hide to screen reader header
>from sighted users, but what is the best practice for telling screen
>readers to ignore the normal-header? I am just guessing about how
>to do it. Suggestions welcomed.
><div id="container">
> <table id="headerTable" title="Scrolling header
> for sighted users. Others skip to 'header-for-readers'>
> <tr id="normal-header" >
> <td>Header cell0</td>
> <td>Header cell1</td>
> </tr>
> </table>
> <table id="bodyTable">
> <tr id="Header-for-readers"
> style="display:None;" title="header-for-readers">
> <th>Header cell0</th>
> <th>Header cell1</th>
> </tr>
> <tr>
> <td>Data cell0</td>
> <td>Data cell1</td>
> </tr>
> <tr>
> <td>Data cell0</td>
> <td>Data cell1</td>
> </tr>
> </table>
>Moore, Michael wrote:
>>I would just like to add that the only way of getting assistive
>>technology, specifically screen readers, to properly report row and
>>column headers, which seems to be your intent, is to use table markup,
>>with row and column headers defined in the code.
>>-----Original Message-----
>>[mailto: <EMAIL REMOVED> ] On Behalf Of Gareth Dart
>>Sent: Wednesday, June 18, 2008 3:22 AM
>>To: WebAIM Discussion List
>>Subject: Foreign:Re: [WebAIM] Making a grid of divs appear as a "table"
>>Hello, and welcome to the list.
>>I'm a little unsure what you're trying to achieve below, however, one
>>thing I will say is that if you have a wadge of tabular data to display,
>>then use a table. Don't make the mistake (as many people do, with the
>>noblest intentions) of confusing the tenet 'tables should not be used
>>for page layout' with 'tables should not be used full stop'. Tables can
>>and should be used when they are the appropriate tool for the job, and
>>it sounds like they are for your purposes.
>>Gareth Dart
>>Web Developer
>>Higher Education Statistics Agency (HESA)
>>95 Promenade, Cheltenham, Gloucestershire GL50 1HZ
>>T 01242 211128 F 01242 211122 W <http://www.hesa.ac.uk>;www.hesa.ac.uk