Do not override text spacing with !important

Last updated:

How to fix this issue?

Remove !important from CSS rules that set text spacing properties:

BAD:

!important prevents user overrides

p {
  line-height: 1.2 !important;
  letter-spacing: 0.05em !important;
  word-spacing: 0.1em !important;
}
CORRECT:

no !important

p {
  line-height: 1.5;
  letter-spacing: 0.05em;
  word-spacing: 0.1em;
}

The same rule applies to inline styles:

BAD:
<p style="line-height: 1 !important;">Text here</p>
CORRECT:
<p style="line-height: 1.5;">Text here</p>

If the design requires specific spacing, set it without !important and test that user stylesheets can override it. WCAG 1.4.12 requires the page to remain readable with these minimum spacing values:

  • Line height at least 1.5 times the font size
  • Letter spacing at least 0.12 times the font size
  • Word spacing at least 0.16 times the font size

Why is this important?

Some users need wider letter spacing, increased line height, or larger word spacing to read text comfortably. This includes people with dyslexia, low vision, or cognitive disabilities. Using !important on spacing rules blocks user stylesheets and browser extensions from applying these adjustments.

More info:

WCAG 1.4.12 Text Spacing.

Rule info

Standard

WCAG AA SC 1.4.12

Regulations

EN 301 549 EAA AODA

User impact

Fix complexity

Affects

Was this article helpful?

Checkout the ExcellentWebCheck services

ExcellentWebCheck's goal is to improve the online user experience. The tools of ExcellentWebCheck help to detect and improve usability problems on your website.