CONTENT SECURITY POLICY
Fix “style-src 'self'” inline-style errors
Move inline CSS into a local stylesheet so an AI-built static site works under Small Site's strict style-src 'self' Content Security Policy.
Remove style attributes, style elements, and JavaScript that writes element.style. Put those declarations in a local CSS file, assign semantic classes in the HTML, rebuild the site, and upload the corrected static output.
Use this when the browser console says an inline style violates Content Security Policy or Small Site rejects an active browser feature.
Why the browser blocks it
Small Site derives a restrictive Content Security Policy from the manifest. With style-src 'self', the browser may load stylesheets from the site's own origin, but it will not execute style attributes or embedded style blocks. This keeps the declared network and execution boundary understandable.
Do not solve this by adding unsafe-inline, copying a one-off hash, or weakening the policy. Customers cannot submit raw response headers; fix the site files instead.
Primary reference: MDN: CSP style-src.
Replace inline style with a class
<!-- Before: blocked -->
<section style="background: #14231b; color: white">...</section>
<!-- After: allowed HTML -->
<section class="hero">...</section>
/* assets/styles.css */
.hero {
background: #14231b;
color: white;
}Check generated and JavaScript-driven styles too
- Search HTML for style= and style elements.
- Search JavaScript for .style, setAttribute("style"), and libraries that inject style elements at runtime.
- Replace visual state changes with CSS classes and classList toggles.
- Use external local stylesheets and rebuild framework output after editing source.
A framework or animation library can create inline styles even when you did not type them directly. Test the built output in a browser with the production policy, not only the source files.
READY WHEN THE ZIP IS
Validate it. Scan it. Put it online.
Small Site publishes bounded static artifacts at a stable HTTPS URL. The public founding beta is $5 USD/month for up to three active sites.
Create an account and publish