Techniques for WCAG 2.0

Skip to Content (Press Enter)

-

C25: Specifying borders and layout in CSS to delineate areas of a Web page while not specifying text and text-background colors

Applicability

Pages that use CSS.

This technique relates to:

Description

The intent of this technique is to specify borders and layout using CSS and leave text and background colors to render according to the user's browser and/or operating system settings. This allows users to view the text in the colors they require while maintaining other aspects of the layout and page design such as columns of text, borders around sections or vertical lines between a menu and main content area. It will also prevent some display issues in some browsers when pages contain Javascript pop-up boxes or drop-down menus and have the colors overridden.

Borders and layout indicators help many people with cognitive disabilities, as does flexibility over the text and background colors. Sometimes these two needs are in conflict when the user has to over-ride the author's color selection of text and background in the browser and the browser also removes the borders and the intended layout. This can mean the page is displayed in a single column with one block of content below the other, which can result in unnecessary whitespace and long lines of text. It can also mean that pop-up boxes gain a transparent background, superimposing the text of the box on the text of the page, and drop-down menus either become transparent or gain a dark-grey background. When a Web author does not specify the colors of any text and background, while specifying border colors and layout, it is possible, in most popular browsers, to change the text and background colors without affecting the other (author-specified) CSS declarations.

Examples

Example 1

A Web page is designed using HTML. CSS is used to specify border colors around discrete areas of the page and to layout the content so that the menu floats to the left of the main content area. Neither the text color nor background is specified. The user sets their own colors in the browser. They can view the page in colors and contrasts that work well for them without disrupting the layout.

Resources

Resources are for information purposes only, no endorsement implied.

Tests

Procedure

  1. Open the Web page in a browser that allows users to change colors of HTML content.

  2. Change the text, link and background colors in the browser settings so they are different than those currently set in the browser.

    Note: Make sure that you do not select the option that tells the browser to ignore the colors specified in the page.

  3. Return to the page and check that it is displaying the page in the new text, link and background colors.

  4. Check that any borders are still displayed and that the layout is retained.

Expected Results