Critical CSS is a subset of Cascading Style Sheets (CSS) that's used to enhance the user experience and speed of a website.
What it does: Breaks your code into smaller bundles to load only what's necessary.
How to implement: Use tools like Webpack, Rollup, or native features in frameworks like React's React.lazy
and Suspense
.
Example:
const LazyComponent = React.lazy(() => import('./Component'));
Use modern formats: Convert images to WebP or AVIF for smaller file sizes.
Lazy Loading: Load images only when they appear in the viewport.
<img src="image.jpg" loading="lazy" alt="Optimized Image">