Techniques for WCAG 2.0

On this page:

-

# F48: Failure of Success Criterion 1.3.1 due to using the `pre` element to markup tabular information

## Applicability

HTML and XHTML

This failure 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

This document describes a failure caused by use of the HTML `pre` element to markup tabular information. The `pre` element preserves only visual formatting. If the `pre` element is used to markup tabular information, the visually implied logical relationships between the table cells and the headers are lost if the user cannot see the screen or if the visual presentation changes significantly.

Instead, the HTML `table` element is intended to present tabular data. Assistive technologies use the structure of an HTML table to present data to the user in a logical manner. This structure is not available when using the `pre` element.

## Examples

### Failure Example 1: A schedule formatted with tabs between columns

Example Code:

     <pre>
     	Monday	Tuesday	Wednesday	Thursday	Friday
     8:00-
     9:00	Meet with Sam
     9:00-
     10:00			Dr. Williams	Sam again	Leave for San Antonio
     </pre>

### Failure Example 2: Election results displayed using preformatted text

Example Code:

     <pre>
       CIRCUIT COURT JUDGE BRANCH 3
                                                      W
                                                       R
                                              M R E     I
                                               A . L     T
                                         M L    R   B     E
                                          I A    Y   E     -
                                           K N        R     I
                                            E G        T     N
                                           -----   -----   -----
    0001 TOWN OF ALBION WDS 1-2               22      99       0
    0002 TOWN OF BERRY WDS 1-2                52     178       0
    0003 TOWN OF BLACK EARTH                  16      49       0
    0004 TOWN OF BLOOMING GROVE WDS 1-3       44     125       0
    0005 TOWN OF BLUE MOUNDS                  33     117       0
    0006 TOWN OF BRISTOL WDS 1-3             139     639       1
    0007 TOWN OF BURKE WDS 1-4                80     300       0
    0008 TOWN OF CHRISTIANA WDS 1-2           22      50       0

     </pre>

## Resources

No resources available for this technique.

## Related Techniques

- H51: Using table markup to present tabular information

## Tests

### Procedure

1. Check to see if the `pre` element is used

2. For each occurrence of the `pre` element, check whether the enclosed information is tabular.

### Expected Results

- If check #2 is true, then this failure condition applies and the content fails the Success Criterion.

- Top
- Contents
- Intro
- Previous: Failure F47
- Next: Failure F49