Every image on a page can be placed two ways: as an image element in the markup, or as a background in CSS. The choice is not a matter of convenience, and getting it wrong either hides information from part of your audience or clutters the document with decoration.
The rule
If the image conveys information, it belongs in the HTML. If it is decoration, it belongs in the CSS.
The reasoning is that a background image is invisible to assistive technology. It has no alt text, it is not announced, and it does not appear in the images list a screen reader can produce. For decoration that is exactly right. For a product photograph it means the photograph does not exist for those users.
Content images
Product photographs, article illustrations, diagrams, charts, screenshots, avatars and logos are all content. They belong in the markup with descriptive alt text.
There is a practical test. Ask whether the page would still make sense if the image were replaced by a paragraph describing it. If it would, the image is carrying meaning and needs to be in the document.
A second test is whether the image changes with the content. A product photograph differs for every product, which means it is data rather than styling, and data belongs in the markup where a template can output it.
Decorative images
Background textures, gradients, section dividers, patterns behind a heading and purely aesthetic flourishes are decoration. They belong in the stylesheet.
Putting them in CSS keeps the markup clean, groups them with the rest of your design decisions, and makes them straightforward to change or remove per theme or per breakpoint. It also means they are naturally skipped by assistive technology without needing an empty alt attribute on every one.
The hero image question
Large banner images with text over them are the case that causes most disagreement, and the honest answer is that it depends on the image.
A generic atmospheric photograph behind a headline is decoration. The headline carries the message and the picture sets a mood, so a background is correct.
A hero showing the actual product being sold is content. Someone who cannot see it is missing the main subject of the page, so it belongs in the markup.
There is a performance dimension too. A background image is only discovered once the stylesheet has been parsed, which delays it relative to an image element found during initial parsing. For the largest visible element on a page, that delay directly affects the largest contentful paint measurement.
Object fit removed the old excuse
Historically, backgrounds were used for content images because only backgrounds could be cropped and scaled to fill a container. An image element stretched to fit was distorted.
The object fit property solved this.
.card-image { width: 100%; height: 220px; object-fit: cover; } Cover scales the image to fill the box and crops the overflow, exactly as a background with cover sizing does. The companion object position property controls which part is kept, so a portrait can be biased towards the top rather than centred on someone's chin.
With that available, there is no longer a technical reason to make a content image a background, and card layouts should use image elements with alt text.
Images that are also links
A common pattern places a background image on a link or a card and relies on the whole area being clickable. This works visually and leaves the link with no accessible name unless text is present inside it.
Where the image is the only content of the link, use an image element so the alt text can name the destination. Where the card contains a heading and description as well, a background is fine, because the text supplies the name.
Backgrounds and printing
Browsers omit background images when printing by default, which is generally desirable since printing large decorative images wastes ink. It also means a content image placed as a background disappears from the printed page entirely, which is another argument for keeping meaningful images in the markup.
Responsive backgrounds
Backgrounds can be swapped at breakpoints with media queries, which is a form of art direction. What they cannot easily do is resolution switching, since there is no equivalent of the srcset mechanism, so you end up serving one file to every density of screen.
For a large decorative image that difference is often acceptable. For anything where quality and bandwidth both matter, the image element with a proper source set gives you control that a background cannot.