How do you swap a background image at a responsive breakpoint?

Swap a CSS background image by declaring the default source first and overriding only background-image inside a media query. Start with the smaller image when the stylesheet follows a mobile-first approach. The breakpoint should match the composition change in the component instead of a device model name.
Keep shared rules such as size, repeat and position outside the media query. This prevents the wide version from accidentally losing background-size: cover or a fallback color. Give each crop its own focal position if the subject moves between files. Both images should communicate the same visual meaning.
.campaign-hero {
background: #16202f url('campaign-mobile.webp') 50% 35% / cover no-repeat;
}
@media (min-width: 48rem) {
.campaign-hero {
background-image: url('campaign-wide.webp');
background-position: 70% 50%;
}
}
A browser normally downloads the image used by the matching CSS rule, although preload behavior, cached files and competing declarations can affect network observations. Check the Network panel at both widths and reload with cache disabled. Avoid placing the same source in an inline style because its specificity may defeat the media-query override.
If the background contains meaningful content, use an HTML picture element instead. CSS backgrounds have no alternative-text mechanism and are best for decoration. An img also gives the browser stronger responsive-image selection, intrinsic dimensions and loading controls. Keep headings, labels and calls to action in HTML over the visual layer.
Test just below and above the breakpoint, then test a narrow landscape viewport and a wide but short window. The new source should not flash over an unstyled section, move text or reduce contrast. Document the two crop filenames and their intended ranges so a later asset replacement does not reverse them.