Unminified inline CSS
- CSS
Problem Summary
Unminified inline CSS increases page size unnecessarily. While inline CSS avoids HTTP requests, unminified code contains whitespace, comments, and inefficient selectors that add bytes to every page load.
Performance Impact
- Larger HTML size: Inline CSS adds to document size
- Slower parse time: Larger CSS takes longer to process
- Affects all pages: Inline code loads everywhere
How to Detect
- PageSpeed Insights: Checks HTML size and structure
- Chrome DevTools Elements: View inline style blocks
- GTmetrix: Shows inline CSS size
Solutions
1. Minify Inline CSS
Remove whitespace and comments:
/* Before */.header { background: #ffffff; margin: 0px; padding: 10px; }/* After */.header{background:#fff;margin:0;padding:10px}2. Move to External Files
If inline CSS is large, move to external cached file.
3. Use Build Tools
Tools like cssnano or clean-css can minify automatically.