To create a responsive background image in Webflow without degrading mobile page speed, you need to use optimized images, set correct styling, and limit unnecessary loading. Here's how:
1. Use Background Image on Divs, Not the Body
- Avoid setting background images directly on the
body
element, which loads universally across all breakpoints. - Instead, use a Div block as your container with a background image and control its display across breakpoints.
2. Upload Appropriately Sized Images
- Use multiple image variants for different screen sizes (mobile, tablet, desktop).
- Compress images to reduce file size with tools like TinyPNG or Squoosh.
- Webflow automatically generates resized versions, but it's still best to control what you're uploading.
3. Use Background Image Styling Settings
- Set the image using Style Panel > Backgrounds on a specific Div.
- Choose Cover for background size and Center for position.
- Check Don’t repeat to prevent tiling.
4. Hide Background Images on Smaller Breakpoints
- If the background image is decorative or non-essential on mobile:
- Go to the mobile breakpoint.
- Set display: none on the Div containing the background image.
- This ensures the image won’t load on mobile devices, improving speed.
- Use modern formats like WebP when possible, which offer smaller file sizes with high quality.
- Webflow supports WebP as of 2024 in image uploads.
6. Lazy Load Wherever Possible
- While background images cannot use
loading="lazy"
like inline images, you can: - Use actual
<img>
elements for critical visuals instead of background images. - For decorative sections, combine lazy-loaded inline images with absolute positioning and CSS if you need full coverage.
7. Minimize Use of Fixed Backgrounds
- Avoid the ‘Fixed’ background option, as it can dramatically impact performance, especially on mobile.
Summary
To keep background images responsive and fast in Webflow, use Divs with optimized image sizes, apply them only where needed, and hide or replace them on smaller breakpoints. For better loading performance, avoid applying background images universally or using fixed positioning.