← Web Performance (Core Web Vitals) learning pathWeb Performance (Core Web Vitals) · Module 3 of 8
Images and media
Usually the biggest bytes on a page.
📖 Key ideas
- Use modern formats such as WebP or AVIF, which are often much smaller than JPEG or PNG at similar quality.
- Serve sizes that match the screen using srcset and sizes, instead of one huge image for everyone.
- Lazy-load images below the fold with loading="lazy", but not the main hero image.
- Always set width and height so the browser reserves space.
- For video, use a poster image and do not autoplay large files on mobile.
💡 Real-life example: Sending a 4000-pixel photo to a phone screen 400 pixels wide is like delivering a full truck of rice to someone who ordered one bag.
WebPModern image format, smaller than JPEG at similar quality
srcsetHTML attribute listing image sizes for the browser to choose
Lazy loadingLoading an item only when it is about to be seen
Above the foldPart of the page visible without scrolling