Back to Info and Examples for Accessibility Insights for Web
avoid-inline-spacing
Inline text spacing must be adjustable using custom stylesheets.
Why it matters
People with low vision or dyslexia can find it difficult to read closely spaced text. An external CSS style sheet can be used to adjust text spacing and thereby improve the reading experience.
However, using !important
in an inline CSS style causes external stylesheets to be ignored.
How to fix
Remove !important
from these inline style attributes:
line-height
letter-spacing
word-spacing
Example
Fail
line-height
style uses !important
to enforce the specified value.
As a consequence, users can't increase the spacing using an external stylesheet. Some people find the text difficult to read.<p style="line-height: 1.5 !important;"> We the People of the United States, in Order to form a more perfect Union,
establish Justice, insure domestic Tranquility, provide for the common defense, promote the general Welfare,
and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Constitution for the United States of America.</p>
establish Justice, insure domestic Tranquility, provide for the common defense, promote the general Welfare,
and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Constitution for the United States of America.</p>
Pass
!important
removed, external stylesheets can adjust the line-height
value. Users can choose the line spacing that works best for them.<p style="line-height: 1.5">We the People of the United States, in Order to form a more perfect Union,
establish Justice, insure domestic Tranquility, provide for the common defense, promote the general Welfare,
and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Constitution for the United States of America.</p>
establish Justice, insure domestic Tranquility, provide for the common defense, promote the general Welfare,
and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Constitution for the United States of America.</p>
About this rule
This rule passes if:
- No inline styles that affect text spacing use
!important