Build a CSS linear-gradient or radial-gradient background, or drop in an image URL and layer a translucent color overlay on top. Set size, position, and repeat behavior, then copy the finished background-image rule straight into your stylesheet.
Generated background-image CSS will appear here.
A wide photograph in a tall card needs a different crop from the same photograph in a banner. With background-size: cover, the image scales up until both dimensions of the box are filled; whatever extends past the edges is simply cut off. Start with a center position, then try left or right if the subject you actually care about sits closer to one edge then the cover will crop toward the opposite side first.
background-size: contain is the one to reach for when the whole image has to stay visible, such as a logo or a diagram. Pair it with no-repeat for a single copy; leave repeat on and the leftover space around a contained image will fill with tiled copies instead of staying empty. Test the finished background at a few different box widths, since the preview here only shows one shape, and a crop that looks right at 400px wide can crop out the subject entirely at 1200px.
A CSS background never gives its element a height on its own. The box still needs an explicit height or content that establishes one. And if the photograph is conveying information rather than decoration (a product photo, a chart, anything a screen reader user needs to know about), it belongs in an <img> tag with alt text, not a CSS background-image, which is invisible to assistive tech.
Gradient stop positions aren't locked to 0–100%; pushing a stop below 0% or above 100% pulls the color transition off-screen, which is a quick way to get a subtler blend. Gradient colors here are six-digit HEX; the image overlay uses its own opacity value from 0 to 1, independent of anything set on the gradient tab.
background-size: cover fills the box and crops what doesn't fit; contain keeps the entire image on screen and may leave empty space around it; auto renders the image at its native resolution. background-position decides where the visible part is anchored, and background-repeat decides whether it tiles when it's smaller than the box.
The overlay color is declared before the image URL in the generated CSS, so it paints as a layer above the photo rather than behind it. This is what makes it darken or tint the image instead of getting hidden by it. A common starting point for a dark overlay is #020617 at roughly 0.4 opacity; always check any text sitting on top against the actual image, not just the overlay color in isolation, since busy photos can still swallow light text even under a dark tint.
The exported CSS keeps background-image, background-size, background-position, and background-repeat as separate declarations rather than the shorthand background property, so each one can be overridden independently later. Note that one size value applies to every layer in the stack, you can't set cover for the overlay and contain for the image underneath it.
One more thing to check once this is in a real stylesheet: a later, broader background shorthand rule elsewhere in your CSS will silently reset image, size, position, and repeat all at once if it has higher specificity or comes later in the cascade. To be clear about what this tool actually produces, the output references the image by URL; it doesn't fetch, optimize, or bundle the file into your project.
Related Tools
Build and preview common CSS Grid layout patterns.
Build linear and radial gradients with custom color stops.
Remove, replace, and export image metadata.
Generate and inspect solid background-color declarations.
Generate uniform or side-specific CSS border declarations.
Generate uniform, corner, and elliptical border-radius CSS.