Neumorphism, sometimes called soft UI, is the look where buttons and cards seem to be pressed out of, or into, the same material as the background. There are no hard borders or bright colours: just a surface that appears to bulge or dip under a soft light. It became popular in design showcases around 2020, and it is still a recognisable style for dashboards, smart-home controls and music players.
The effect is simple to create in CSS once you understand the lighting model behind it. This guide explains how the two-shadow technique works, what the different shapes mean, how to write the code, and the real usability limits you need to design around.
The lighting model
Neumorphism imitates a single light source shining across a surface. An element that sticks out from the surface:
- catches light on the side facing the light, which appears lighter than the background;
- casts shade on the opposite side, which appears darker than the background.
In CSS this becomes two box-shadow layers on an element that has the same colour as its background:
.soft-card {
background: #e0e5ec;
border-radius: 40px;
box-shadow:
20px 20px 40px #bec3c9,
-20px -20px 40px #ffffff;
}
With the light coming from the top left, the dark shadow is offset down and right (positive x and y), and the light "shadow", really a highlight, is offset up and left by the same distance. The blur softens both so the edge melts into the background.
Because the element and background match, there is no visible edge except the shading itself. That is both the charm of the style and, as we will see, its main weakness.
The four shapes
Changing the element's own background and the shadow type gives four standard variations:
| Shape | Element background | Shadows | Looks like |
|---|---|---|---|
| Flat | Same solid colour | Outer light + dark | A raised flat plate |
| Concave | Gradient, darker towards the light | Outer | A dish curving inwards |
| Convex | Gradient, lighter towards the light | Outer | A dome bulging out |
| Pressed | Same solid colour | Inset light + dark | A hollow pressed into the surface |
The pressed version uses the inset keyword, which draws the shadows inside the element's box:
.soft-button:active,
.soft-button[aria-pressed="true"] {
box-shadow:
inset 6px 6px 12px #bec3c9,
inset -6px -6px 12px #ffffff;
}
Switching between the outer and inset versions is how soft UI shows a toggle being turned on or a button being pressed.
Choosing the numbers
- Distance (the x/y offset) sets how high the element appears to rise. Small controls look right at 4-8px; large cards can use 15-25px.
- Blur is usually about twice the distance. Too little blur gives hard, cartoonish shadows.
- Intensity decides how much darker and lighter the two shadow colours are than the base. Around 10-20% keeps the style soft; more makes it heavy.
- Base colour matters more than in most styles. Very light greys and pastels work best, because you need room to go both lighter and darker. On pure white there is no lighter highlight; on very dark colours the dark shadow disappears.
Generate the CSS
The Neumorphism Generator calculates both shadow colours from your base colour and shows the result live.
- Open the Neumorphism Generator and choose the Base colour (element and background).
- Pick the Light source: top-left, top-right, bottom-left or bottom-right. The shadow offsets flip to match.
- Adjust Size, Radius, Distance, Intensity and Blur with the sliders.
- Choose a Shape: flat, concave, convex or pressed.
- Check the Live preview. Elements larger than 240px are scaled down in the preview, but the CSS keeps your full size.
- Copy the CSS code. It sets width, height, border radius, background and the two box shadows.
Remember to give the page (or the surrounding container) the same background colour as the element, or the illusion breaks.
Making soft UI usable
The biggest criticism of neumorphism is that it is hard to see. Controls are defined only by subtle shading, so for users with low vision, on a dim or glossy screen, or in bright sunlight, buttons can simply disappear into the background.
Meet non-text contrast where it matters
WCAG asks for 3:1 contrast for the visual boundaries of interactive components and their states, when those boundaries are what identifies the control. Soft shadows alone rarely achieve that. Practical fixes include:
- a clearly visible icon or text label on every control, with 4.5:1 contrast;
- a thin border or a slightly different fill colour on interactive elements;
- stronger shading for buttons than for decorative cards.
The colour contrast checker helps confirm label and icon colours pass.
Make states obvious
Pressed and unpressed states can look very similar. Add a second cue, such as the label or icon changing colour, a check mark, or an aria-pressed attribute that assistive technology can announce.
Never remove focus outlines
Keyboard users need a visible focus indicator. Keep or restyle :focus-visible with a clear outline rather than relying on shadow changes:
.soft-button:focus-visible {
outline: 3px solid #2563eb;
outline-offset: 4px;
}
Use it sparingly
Many teams use neumorphism for a few showcase elements, such as a large dial or a card group, and keep conventional, high-contrast buttons for primary actions like "Pay" or "Submit". That keeps the aesthetic without hurting task completion.
Other ways to build it
- Hand-writing box shadows is fine once you understand the pattern: same distance, opposite sign, one darker and one lighter colour. The box shadow generator gives full control over individual shadow layers if you want asymmetric or coloured variations.
- Design tools such as Figma can mimic the effect with two drop shadows or inner shadows. Values usually translate directly into CSS.
- Glass instead of soft: if your background is colourful rather than flat, glassmorphism is the better-suited style; the two are often confused but need opposite backgrounds. The frosted glass guide covers that approach.
Troubleshooting
The effect looks flat or dirty
Check that the element's colour exactly matches its background. Even a small difference creates a visible edge that fights with the shading. If the highlight looks grey, the base colour may be too dark; try a lighter base or reduce intensity.
Shadows are clipped
A parent with overflow: hidden cuts off shadows that extend beyond the element. Add padding to the parent or remove the overflow rule.
Rounded corners look wrong
Very large radii on small elements turn them into pills or circles, which is often what you want for toggles. For cards, a radius around 15-25% of the element's shorter side usually looks balanced; the border radius generator helps with uneven corners.
Frequently asked questions
What is neumorphism in UI design?
It is a style where elements share the background colour and are shaped only by a light highlight and a dark shadow, so they look extruded from or pressed into the surface.
How do you make a neumorphic shadow in CSS?
Use two box-shadow layers with equal and opposite offsets: one darker than the background towards the shaded side and one lighter towards the light source, both with generous blur.
Why is neumorphism criticised for accessibility?
Controls are defined by low-contrast shading, so they can be hard to see and their states hard to tell apart. Clear labels, borders and focus outlines are needed to compensate.
What colours work best for neumorphism?
Light, low-saturation colours such as soft greys, blues and pastels. They leave room for both a lighter highlight and a darker shadow.
How do I make a pressed neumorphic button?
Use the same two shadows with the inset keyword, usually with a smaller distance, and switch to them on :active or when the button is toggled on.