Back to Glossary
Design & Typography

Drop Shadow

What Is a Drop Shadow?

A drop shadow is a copy of an object’s shape in a dark color, offset and drawn behind it, so the object seems to float above the background. Blurring the copy’s edges and darkening only what lies underneath make it look like a shadow cast by a light.

Interfaces put drop shadows on windows, menus and buttons, and designers add them to text and icons that have to stand out from any background. A shadow can follow the object’s outline or only the box around it, and a cutout with gaps, like the mug below, shows the difference best.

Cast a shadow yourself

Move the light, then change how far and how soft the shadow falls. Switch the shadow between the shape and the box to see what a cutout needs.

Light from the upper left puts the shadow 12 px toward the lower right.

drop-shadow() follows the mug's outline, through the gap in the handle too.

filter: drop-shadow(8.49px 8.49px 8px rgb(0 0 0 / 0.35));

CE.SDK offsets for this light and distance: x 8.49, y 8.49.

The stage draws each shadow with the CSS line above. drop-shadow() reads its blur as a standard deviation, half of what box-shadow and text-shadow read, so the tool passes it half the Blur value and both modes look equally soft.

How Do You Make a Drop Shadow Look Realistic?

A realistic drop shadow behaves like a shadow from a real light: it falls away from one light source, grows softer as the object rises and is tinted by the surface below it.

One light source for every shadow

Every shadow on a page should fall in the same direction, as if a single light lit the whole scene, and designers usually place that light above the page, often a little to the left. Photoshop’s Use Global Light setting gives every layer style in a document the same angle.

Higher objects cast larger, softer shadows

The higher an object floats above a surface, the bigger and blurrier its shadow becomes. Android draws shadows from each view’s elevation this way, and a page can use the same rule to show what sits on top: a dialog gets a wider, softer shadow than a card resting on the page.

A darker surface color instead of black

A black shadow at low opacity grays out the color it falls on, while a darker version of the surface color keeps the surface’s hue. Photoshop drop shadows use the Multiply blend mode, which only darkens what lies below. Switch the tool’s color to Surface tint to compare.

Two or three stacked shadows

A single shadow can look flat. Stacking two or three, each with a larger offset and blur than the one before, gives a smoother falloff, and CSS takes a comma-separated list in box-shadow and text-shadow, or several drop-shadow() functions in one filter.

What Are the Settings of a Drop Shadow?

Every tool sets the same things under its own names: where the shadow falls, how soft its edge is and how strong it is, plus a spread setting in most. Photoshop asks for an angle and a distance, while Figma and CSS take separate horizontal and vertical offsets.

Setting names as each tool labels them
  Photoshop CSS
Direction and distance Angle and Distance offset-x and offset-y
Softness Size blur radius
Spread Spread spread radius, box-shadow only
Strength Opacity color alpha

Spread doesn’t work the same way everywhere. In CSS, a positive spread radius makes a box shadow bigger and a negative one smaller, while Photoshop’s Spread makes the shadow denser. Figma names its settings X, Y, Blur and Spread, and offers Spread only on rectangles, ellipses, frames and components.

Drop Shadow or Box Shadow in CSS: Which Should You Use?

Use drop-shadow() when the shadow should follow what you see and box-shadow when it should follow the element’s rectangle. An online store’s product grid can use both, with drop-shadow() on the product cutouts so each shadow traces the product and box-shadow on the cards around them. For text, text-shadow follows the letters and takes the same values as box-shadow, without spread or inset.

Use drop-shadow() for

  • Product cutouts and other images with transparent areas

  • Icons, logos and SVG shapes that aren't rectangles

Use box-shadow for

  • Cards, buttons, menus and dialogs, which are rectangles anyway

  • Spread and inner shadows, which drop-shadow() doesn't draw

How Drop Shadows Work in CE.SDK

Text, shape and image blocks each have a shadow, and your users turn it on in the CE.SDK editor and set its color and opacity, its angle and distance, and its blur. The shadow is a property of the block, apart from the effects a block stacks, and it is off by default, set to black at 25% opacity.

It follows the visible shape, so the shadow of an image with transparent areas, such as a product photo after background removal, traces the product. Shadows can also use CMYK or spot colors in print designs, and an SVG export embeds the shadow as an image. For a glow on an image or shape, CE.SDK has a separate glow effect, while glowing text uses a drop shadow with no offset.

In code, positive offsets move the shadow right and down, and the same calls exist on iOS, Android and in Node.js. The function here points every shadow in a scene away from one light and keeps each shadow’s distance.

Point every shadow away from one light
// Point every shadow in the scene away from one light.
// lightAngle says where the light comes from, in degrees:
// 0 is from the right, 90 from above, 180 from the left.
function relight(lightAngle) {
  const radians = (lightAngle * Math.PI) / 180;
  for (const block of engine.block.findAll()) {
    if (!engine.block.supportsDropShadow(block)) continue;
    if (!engine.block.isDropShadowEnabled(block)) continue;
    // Keep how far each shadow sits from its block.
    const distance = Math.hypot(
      engine.block.getDropShadowOffsetX(block),
      engine.block.getDropShadowOffsetY(block)
    );
    // The shadow falls away from the light; positive y is down.
    const x = -distance * Math.cos(radians);
    const y = distance * Math.sin(radians);
    engine.block.setDropShadowOffsetX(block, x);
    engine.block.setDropShadowOffsetY(block, y);
  }
}
relight(135); // light from the upper left
Shadows and glows guide

FAQs

A drop shadow sits outside the object and makes it look raised above the background. An inner shadow is drawn inside the edges, so the object looks pressed into the surface. In CSS, box-shadow draws an inner shadow with the inset keyword, and Figma lists inner shadow as an effect of its own.

Away from the light, and every shadow on the page should fall the same way. Designers usually put the light above the page and a little to the left, so shadows fall down and to the right. A light from straight above makes shadows fall only downward.

Set the offset to zero, raise the blur and pick a bright color instead of a dark one, so the light spreads evenly around the object. CE.SDK also has a separate glow effect for images and shapes.

Usually because the shadow is black and the surface under it has a color. Mixing black into a color grays it out, so a shadow in a darker version of the surface color keeps the surface's hue.

The two read the blur value differently. box-shadow and text-shadow take a blur radius, which the CSS specification sets at twice the standard deviation of the blur, while drop-shadow() takes the standard deviation itself. The same number blurs about twice as much in drop-shadow(), so halve it to match.