How to fix: Excessive inline style attributes
The page contains 3 or more HTML elements with inline style attributes, which CSP cannot inspect and which complicate theming.
Why it matters
Move inline styles to external stylesheets or design tokens.
Inline style attributes cannot be validated against Content-Security-Policy rules like `style-src 'self'` and they couple layout to markup. External stylesheets or CSS modules make the page easier to theme and audit.
How to fix it
- 1Move recurring inline styles into the global CSS or component-level CSS modules.
- 2For dynamic styles (e.g. inline transform values), prefer CSS variables and `style={{ '--var': value }}` over raw inline rules.
- 3Set a CSP `style-src` directive that excludes 'unsafe-inline' once inline styles are eliminated.
Code examples
React with CSS variables
<div
className="card"
style={{ '--card-width': `${width}px` } as React.CSSProperties}
>Nginx CSP
add_header Content-Security-Policy "style-src 'self'" always;References
Detected automatically by VulnRadar. The check id is inline-style-attr, stable across every scan so you can filter or diff on it.
More headers checks
Questions
- How severe is Excessive inline style attributes?
- VulnRadar rates this info severity in the headers category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id inline-style-attr, which stays the same between runs so you can filter, diff, or gate CI on it.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.