This Wiki page is edited by participants of the WCAG Working Group. It does not necessarily represent consensus and it may have incorrect information or information that is not supported by other Working Group participants, WAI, or W3C. It may also have some very useful information.

Using Standard Text Formatting For Tables

From WCAG WG
Jump to: navigation, search

STATUS

  • entered by PeterKorn


Applicability

Plain text documents. Not applicable to technologies that contain markup. This technique relates to:

  • Success Criterion 1.3.1 (Info and Relationships)
    • How to Meet 1.3.1 (Info and Relationships)
    • Understanding Success Criterion 1.3.1 (Info and Relationships)


Description

The objective of this technique is to use text formatting conventions to create tables. Tables are used to display tabular data in columns, so that the contents of a given cell may be clearly associated with other cells sharing the same row or column. Column headers are also clearly discernible.

There are two procedures for creating tables in plain text documents. Both of these are visually discernible using fixed with characters (these techniques were designed for generation on devices like typewriters, or display on fixed character terminals.

Procedure 1: Using character graphics

Use character graphics to create the table structure. The underscore character "_" is used for horizontal lines, while the pipe character "|" is used for vertical lines. Column headers are indicated by being centered and in ALL CAPS. If present, row headers are indicated similarly - by being centered an in ALL CAPS. No blank lines are used within each table cell.

Procedure 2: Using spacing alignment

Use blank space after the contents of each cell such that each column of cells shares the same left alignment within each line of text. If present, column headers are indicated by an initial row, which is then underlined with dash characters "-". This initial row may or may not be similarly aligned; spacing in the dashes is sufficient to demarcate the headers.

Examples

Example 1: Using character graphics

Example Code:


Table with only column headers:
 ____________________________________________________________
|       COL 1 HEADER          |       COL 2 HEADER          |
|_____________________________|_____________________________|
| Contents of first cell      | Contents of second cell     |
|_____________________________|_____________________________|
| Contents of third cell      | Contents of fourth cell     |
|_____________________________|_____________________________|
| Contents of fifth cell      | Contents of sixth cell      |
|_____________________________|_____________________________|


Table with column and row headers:
 __________________________________________________________________________________________
|                             |       COL 1 HEADER          |       COL 2 HEADER          |
|_____________________________|_____________________________|_____________________________|
|       ROW 1 HEADER          | Contents of first cell      | Contents of second cell     |
|_____________________________|_____________________________|_____________________________|
|       ROW 2 HEADER          | Contents of third cell      | Contents of fourth cell     |
|_____________________________|_____________________________|_____________________________|
|       ROW 3 HEADER          | Contents of fifth cell      | Contents of sixth cell      |
|_____________________________|_____________________________|_____________________________|

Example 2: Using spacing alignment

Example Code:


Table without column headers (a common UNIX directory listing):

$ ls
bin    etc         initrd.img.old  lost+found  proc        selinux  usr
boot   export      lib             media       RAID-ARRAY  srv      var
cdrom  home        lib32           mnt         root        sys      vmlinuz
dev    initrd.img  lib64           opt         sbin        tmp      vmlinuz.old


Table with aligned column headers (a common UNIX filesystem listing):

$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              40G  8.8G   29G  24% /
none                  748M  288K  748M   1% /dev
none                  752M  916K  751M   1% /dev/shm
none                  752M  552K  752M   1% /var/run
none                  752M     0  752M   0% /var/lock
none                  752M     0  752M   0% /lib/init/rw
none                   40G  8.8G   29G  24% /var/lib/ureadahead/debugfs
/dev/md0              466G  396G   71G  85% /RAID-ARRAY
/dev/sda1             962M   81M  832M   9% /boot
/dev/sda4             185G  188M  176G   1% /export


Table with underlined column headers (a common network connection listing):

$ netstat
Active Connections

  Proto      Local Address          Foreign Address        State
  ------ ---------------------- ---------------------- ----------------
  TCP    127.0.0.1:5354         lightnin:49157         ESTABLISHED
  TCP    127.0.0.1:5354         lightnin:61839         ESTABLISHED
  TCP    127.0.0.1:5354         lightnin:61843         ESTABLISHED
  TCP    127.0.0.1:5354         lightnin:61844         ESTABLISHED
  TCP    127.0.0.1:27015        lightnin:49165         ESTABLISHED
  TCP    127.0.0.1:27015        lightnin:61851         ESTABLISHED
  TCP    127.0.0.1:27015        lightnin:61881         ESTABLISHED
  TCP    127.0.0.1:49157        lightnin:5354          ESTABLISHED
  TCP    127.0.0.1:49165        lightnin:27015         ESTABLISHED
  TCP    127.0.0.1:49208        lightnin:49209         ESTABLISHED
  TCP    127.0.0.1:49209        lightnin:49208         ESTABLISHED
  TCP    127.0.0.1:49343        lightnin:49344         ESTABLISHED
  TCP    127.0.0.1:49344        lightnin:49343         ESTABLISHED

Resources

No resources available for this technique.

Related Techniques

(none currently listed)

Tests

Procedure 1

TO BE WRITTEN

Procedure 2

TO BE WRITTEN

Expected Results

  • All checks above are all true.

If this is a sufficient technique for a success criterion, failing this test procedure does not necessarily mean that the success criterion has not been satisfied in some other way, only that this technique has not been successfully implemented and can not be used to claim conformance.