About this AccessLint rule
When line-height is set with !important in a style attribute and the value is less than 1.5 times the font size, users cannot override the line spacing with their own stylesheets or browser extensions. This creates a problem because many people need to adjust text spacing to read content comfortably.
WCAG Success Criterion 1.4.12 (Text Spacing, Level AA) requires that content and functionality remain intact when users adjust certain text spacing properties, including line height. The expectation is that users can set line height to at least 1.5 times the font size without losing content or breaking functionality. When authors use !important in an inline style attribute with a line height below that threshold, they block this adjustment.
The reason inline !important styles are specifically problematic has to do with how CSS cascade resolution works. A style attribute already has higher specificity than any selector in a stylesheet. Adding !important on top of that makes the declaration nearly impossible to override from the author origin. Assistive technologies and browser extensions that inject custom stylesheets operate at the author origin level, so they cannot override an inline !important declaration. Only user-origin or user-agent-origin !important styles can win the cascade over it, and not all assistive technologies can set styles at those origins.
People affected by this issue include users with dyslexia, cognitive disabilities, and low vision. Tight line spacing causes lines of text to blur together, making it harder to track from one line to the next. Users who adjust text spacing as a reading accommodation are directly blocked when inline !important prevents their overrides from taking effect.
How to fix it
There are two straightforward fixes:
- Increase the
line-heightvalue to at least 1.5 (relative to the font size). If the value already meets or exceeds 1.5, the!importantdeclaration is acceptable because the user's minimum need is already satisfied. - Remove
!importantfrom theline-heightdeclaration in thestyleattribute. This allows user stylesheets and assistive technology overrides to take effect through normal cascade resolution.
If the line-height is defined in an external or embedded stylesheet rather than a style attribute, this rule does not apply, because stylesheet-based declarations can be overridden by other author-origin styles with equal or higher specificity.
This rule only applies to elements that contain visible text with at least one soft wrap break (i.e., text that wraps across multiple lines). Single-line text is not affected because line height has no visual impact when there is only one line.
Examples
Incorrect: line height below 1.5 with !important
<p style="line-height: 1.2 !important;">
This paragraph has tight line spacing that users cannot override.
The text wraps to multiple lines, making the insufficient
line height a readability problem.
</p>
The line-height of 1.2 is below the 1.5 minimum, and !important prevents user overrides.
Correct: line height at 1.5 or above with !important
<p style="line-height: 1.5 !important;">
This paragraph meets the minimum line height threshold.
Even though !important is used, the spacing is already
sufficient for readability.
</p>
Because the value is at least 1.5, the requirement is satisfied even with !important.
Correct: removing !important
<p style="line-height: 1.2;">
This paragraph has a line height below 1.5, but without
!important, users and assistive technologies can override
it with their own stylesheets.
</p>
Without !important, the declaration can be overridden through the normal cascade.
Correct: using an external stylesheet instead
<style>
.tight-text {
line-height: 1.2;
}
</style>
<p class="tight-text">
This paragraph gets its line height from a stylesheet rule,
not an inline style attribute. Other author-origin styles
with equal or greater specificity can override it.
</p>
Stylesheet-based declarations are easier to override than inline styles, so this approach does not trigger the rule.
Detect accessibility issues automatically
Rocket Validator scans your site with complementary accessibility engines, helping teams find issues across every page.
Help us improve our guides
Was this guide helpful?
๐
Trusted by teams worldwide
Validate at scale.
Ship accessible websites, faster.
Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.
Scheduled Reports
API Access
Open Source Standards
$7
/ 7 days
Pro Trial
Full Pro access. Cancel anytime.
Start Pro Trial โ
Join teams across 40+ countries