Technique C14:Using em units for font sizes
Applicability
CSS
This technique relates to:
- 1.4.4: Resize text (Sufficient when used with Ensuring that text containers resize when the text resizes AND using measurements that are relative to other measurements in the content by using one or more of the following techniques: Techniques for relative measurements)
- 1.4.5: Images of Text (Advisory)
- 1.4.8: Visual Presentation (Sufficient when used with G146: Using liquid layout)
- 1.4.9: Images of Text (No Exception) (Advisory)
Description
The objective of this technique is to specify text font size in em units so that user
agents can scale content effectively. Since the em is a property of the font, it scales
as the font changes size. If a font-size is specified for the body
element, all other elements inherit that value, unless overridden by a more specific
selector.
Examples
Example 1: Em font sizes in CSS
This example defines the font size for strong element so that its text will always be larger than the surrounding text, in whatever context it is used. Assuming that headings and paragraphs use different font sizes, the strong words in this example will each be larger than their surrounding text.
strong {font-size: 1.6em} ... <h1>Letting the <strong>user</strong> control text size</h1> <p>Since only the user can know what size text works for him, it is <strong>very</strong> important to let him configure the text size. </p> …
Other sources
No endorsement implied.
Tests
Procedure
- Check that the value of the CSS property that defines the font size is expressed in em units.
Expected Results
- Check #1 is true