Set the lighting direction on a neumorphic CSS card
Admin ·
A soft raised surface gets depth from two shadows on opposite sides. Start with the same color on the card and its background, then use the direction and strength of the shadows to see how the shape reads.
Raise a card with top-left light
Select Reset settings. The card uses Surface color #dce6f0, a 24 px corner radius and the Raised shape. Keep Top left, 10 px offset, 20 px blur and 24% strength.
The dark shadow moves 10 px right and 10 px down. The light shadow moves 10 px left and 10 px up. The card and the surrounding preview use the same base color.
.neumorphic-surface {
border-radius: 24px;
background: #dce6f0;
box-shadow: 10px 10px 20px #a7afb6, -10px -10px 20px #e4ecf4;
}W3C CSS Backgrounds and Borders, box-shadowW3C CSS Backgrounds and Borders, rounded corners
Move the light and recess the surface
Choose Top right. The dark shadow's horizontal offset becomes -10 px and the light shadow's becomes 10 px. The vertical offsets stay the same.
Change Surface shape to Inset. The download adds inset to both shadows and the preview pulls the edges into the card. Try Convex or Concave to add a directional surface gradient while keeping the paired outer shadows.
W3C CSS Backgrounds and Borders, box-shadowW3C CSS Images, linear gradients
Apply and check the saved CSS
Download neumorphic-surface.css and apply its class to a card. Set the card dimensions in your layout and use the selected surface color on its parent. Check that the stylesheet contains two shadows and that the edge follows the corner radius.
If the outside shadow disappears near a container edge, check whether the parent clips overflow. For controls, use a visible label and focus indicator so a subtle shadow does not carry the control's meaning by itself.
W3C CSS Backgrounds and Borders, box-shadowW3C WAI, understanding Focus Visible
Common questions
Which setting softens the edge without moving the shadows?
Change Shadow blur. The horizontal and vertical displacement comes from the offset and light direction.
Will a new page background affect how the card looks?
Yes. The light and dark shadow colors derive from the chosen base. Preview the card on the background you plan to use.
Sources
Put it into practice.
- CSS Neumorphism Generator
- CSS Neumorphism Generator
- CSS Box Shadow Gradient Playground
- Contrast checker