Apply filter: drop-shadow(0 12px 12px rgb(33 50 40 / 0.37)) to a transparent food image to give the cutout a soft shadow. The filter uses the visible shape of the image. To lift a whole menu card, apply box-shadow to the card instead.
Try three shadows on the same avocado cutout
Toggle the controls and look at the corners. With Shape shadow, the avocado and its pit keep their outline and the empty corners stay the color of the panel. With Box shadow, the rectangular image bounds become visible, including areas where the file is transparent. This demo uses the same AI-generated Avocado Cutout on the same background for every option.
Put the filter on the image
Add the class to the image itself and keep the panel color on its container. These settings move the shadow 12 pixels down, apply a 12-pixel standard deviation for the blur and use a dark green at 37% opacity.
.food-cutout {
display: block;
width: min(100%, 236px);
height: auto;
filter: drop-shadow(0 12px 12px rgb(33 50 40 / 0.37));
}
Change the second length for a higher or lower shadow. Increase the third length for a softer edge. The third length in drop-shadow() is the Gaussian standard deviation, so matching the numbers in box-shadow does not guarantee the same blur. The W3C definition of the filter specifies those values.
Check the file and the spacing
If both options look rectangular, inspect the image for transparency. An opaque background gives the filter a solid rectangle to work with. The supplied avocado WebP contains an alpha channel. An exported PNG with its transparency preserved works the same way in this example. If empty pixels make the cutout look too small in its card, trim the transparent padding before setting the display width.
If the shadow gets cut off near a card edge, make room in the container and check whether an ancestor clips overflow. Preview on the actual card color. A shadow that separates an avocado from pale green can disappear against dark green. The effect is rendered by the browser and leaves the downloaded image unchanged.



