Techniques for WCAG 2.0

On this page:

-

# F1: Failure of Success Criterion 1.3.2 due to changing the meaning of content by positioning information with CSS

## Applicability

All technologies that support CSS.

This failure relates to:

- Success Criterion 1.3.2 (Meaningful Sequence)
  - How to Meet 1.3.2 (Meaningful Sequence)
  - Understanding Success Criterion 1.3.2 (Meaningful Sequence)

## Description

This describes the failure condition that results when CSS, rather than structural markup, is used to modify the visual layout of the content, and the modified layout changes the meaning of the content. Using the positioning properties of CSS2, content may be displayed at any position on the user's viewport. The order in which items appear on a screen may be different than the order they are found in the source document. Assistive technologies rely on the source code or other programmatically determined order to render the content in the correct sequence. Thus, it is important not to rely on CSS to visually position content in a specific sequence if this sequence results in a meaning that is different from the programmatically determined reading order.

## Examples

### Failure Example 1

The following example demonstrates how CSS has been improperly used to create a set of columns. In addition, the text appears visually in the browser in a different order than in the markup.

In this example a class is defined for each object that is being positioned. When style sheets are applied, the text appears in two columns. Elements of class "menu1" (Products) and "menu2" (Locations) appear as column headings. "Telephones, Computers, and Portable MP3 Players" are listed under Products and "Idaho" and "Wisconsin" are listed under Locations (note the different order for Idaho and Wisconsin in the source code order).

Since appropriate structural elements have not been used, when style sheets are not applied, all of the text appears in one line in the source order, "Products Locations Telephones Computers Portable MP3 Players Wisconsin Idaho."

Here is the HTML content:

Example Code:

    <div class="box">
         <span class="menu1">Products</span>
         <span class="menu2">Locations</span>
         <span class="item1">Telephones</span>
         <span class="item2">Computers</span>
         <span class="item3">Portable MP3 Players</span>
         <span class="item5">Wisconsin</span>
         <span class="item4">Idaho</span>
    </div>

Here are the styles for the above content:

Example Code:

    .menu1 {
         position: absolute;
         top: 3em;
         left: 0em;
         margin: 0px;
         font-family: sans-serif;
         font-size: 120%;
         color: red;
         background-color: white
    }
    .menu2 {
         position: absolute;
         top: 3em;
         left: 10em;
         margin: 0px;
         font-family: sans-serif;
         font-size: 120%;
         color: red;
         background-color: white
    }
    .item1 {
         position: absolute;
         top: 7em;
         left: 0em;
         margin: 0px
    }
    .item2 {
         position: absolute;
         top: 8em;
         left: 0em;
         margin: 0px
    }
    .item3 {
         position: absolute;
         top: 9em;
         left: 0em;
         margin: 0px
    }
    .item4 {
         position: absolute;
         top: 7em;
         left: 14em;
         margin: 0px
    }
    .item5 {
         position: absolute;
         top: 8em; left: 14em;
         margin: 0px
    }
    #box {
         position: absolute;
         top: 5em;
         left: 5em
    }

A better solution for this content would be to use more meaningful elements, such as a table or a definition list.

- Example of CSS positioning failure

- Example of CSS positioning failure with styles removed

## Resources

No resources available for this technique.

## Related Techniques

- C6: Positioning content based on structural markup

## Tests

### Procedure

For content which uses CSS for positioning:

1. Remove the style information from the document or turn off use of style sheets in the user agent.

2. Check that the reading order of the content is correct and the meaning of the content is preserved.

### Expected Results

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

- Top
- Contents
- Intro
- Previous: Technique ARIA4
- Next: Failure F2