XML technologies / CSS / CSS Cookbook / Design with CSS / Using contrast to guide the eye
(Excerpt from “CSS Kochbuch” by Christopher Schmitt)
Problem
Use text design to create an impression of depth or movement. For example, when a page has four nearly identical paragraphs (see the next figure), readers struggle to decide which to look at first. Changing the columns’ font sizes in a particular direction, such as decreasing from left to right, guides the reader’s eye (see the following figure).
Figure: Four nearly identical paragraphs.
Figure: Changing the font size guides the reader’s eye from left to right.
Solution
To guide the reader’s eye, change the font size with CSS as shown here:
/* Textgröße */
#layer4 {
font-size: .7em;
line-height: 20px;
}
#layer3 {
font-size: 1em;
line-height: 20px;
}
#layer2 {
font-size: 2em;
line-height: 10px;
}
#layer1 {
font-size: 3em;
line-height: 10px;
}Discussion
Contrast arises when two elements differ visibly. Without it, readers struggle to distinguish important content from less important material. Changing an element’s presentation creates contrast between elements. Presentation parameters include:
Size
Color
Shape
Position on the page
Direction
Density
Correctly marked-up text already has an inherent style because the browser uses its own stylesheet when no other styles are provided. Headings, such as h1, appear bold and separate from the rest of a paragraph (see the next figure). This distinct appearance provides the contrast readers need to understand the document more easily.
Figure: Drawing attention to headings with larger, bold type.
Without stylesheet cues, the eye can easily get lost in a document. The next figure’s layout is confusing because it fails to give readers a clear reading direction. Headings and body text use the same font, size and color.
Figure: The same page as before, without contrast.
See also
Effective Color Contrast on creating effective contrast.
Copyright of the German edition © 2007 by O’Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from “CSS Kochbuch” is subject to the same conditions as the bound edition: the work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstr. 81, 50670 Köln