Text Spacing
The text spacing rule checks whether there is adequate space between paragraphs, lines, and words. Sufficient space helps users easily distinguish and comprehend content. This is important for improving readability for users with dyslexia, low vision, or cognitive impairments.
- Rule Category :
Readable Text and Layout
- WCAG 2.1 SC :
1.4.12 (AA)
- WCAG 2.2 SC :
1.4.12 (AA)
- Rule Severity :
Moderate
- Supported Platforms :
Android
Success Criteria
This rule verifies that the text has enough space between lines, words, and paragraphs to improve readability. The specific criteria for success are:
- Line height is at least 1.5 times the font size.
- Space between paragraphs is 2 times the font size.
- Space between words is at least 0.16 times the font size.
How to fix?
To prevent text spacing violations:
-
Line height
Set the line height to at least 1.5 times the font size. You can set the height using various properties, such asandroid:lineSpacingExtra
,lineSpacingMultipliers
, and others. -
Paragraph spacing
Set the space between text views in Android to 2 times the font size. Use parameters similar tolayout_marginBottom
andlayout_marginTop
to set the spacing. -
Word spacing
Set the space between words to at least 0.16 times the font size. You can use theandroid:letterSpacing
property to set the spacing for Android.
Example
Consider the following example:
Error:
The example highlights multiple text spacing violations:
- In violations #2 and #4, the paragraph and word spacing are set correctly, but the line spacing is not set.
- In violation #3, none of the required parameters, line height, paragraph spacing, or word spacing, are set.
How to fix:
Ensure that the properties for line height, paragraph spacing, and word spacing are set correctly as follows:
- Line height is 1.5 times the font size.
- Space between text views in Android is 2 times the font size.
- Word spacing is at least 0.16 times the font size.
Reference
- Learn more about Text Spacing: 2.1 - 1.4.12 (Level AA) guideline
- Learn more about Text Spacing: 2.2 - 1.4.12 (Level AA) guideline
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!