Performance: Print stylesheet organization
MEDIUM IMPACT
This affects page load speed and rendering performance when users print a page or use print preview.
@import 'screen-styles'; // separate print stylesheet loaded only for print /* <link rel="stylesheet" href="print.css" media="print"> */
@import 'print-styles'; // print styles included in main stylesheet body { font-size: 1rem; } @media print { body { font-size: 0.8rem; color: black; } }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Print styles inline in main CSS | No extra DOM nodes | Triggers 1 reflow on load | Increases paint cost due to larger CSS | [X] Bad |
| Separate print stylesheet with media="print" | No extra DOM nodes | No reflow on screen load | Paint cost only when printing | [OK] Good |