Skip to main content

How to Create Neumorphism Buttons in CSS

Learn the soft UI design technique that makes buttons look like they're extruded from the background. Step-by-step tutorial with interactive demos.

What is Neumorphism?

Neumorphism (from "new" + "skeuomorphism") is a design style that creates the illusion of UI elements being extruded from or pressed into the background surface.

The effect is achieved using two box shadows: a light shadow on one side (simulating light reflection) and a dark shadow on the opposite side (simulating a cast shadow).

The key requirement is that the button background must match the container background for the effect to work properly.

Step-by-Step Tutorial

1Set the Background Color

The button background must match the container background. This is crucial for neumorphism to work. A light gray like #e0e0e0 is the most common choice.

CSS
.container {
  background: #e0e0e0;
}

.neu-button {
  background: #e0e0e0; /* Same as container */
}

2Add Two Box Shadows

The magic happens with two shadows: a light one (top-left) and a dark one (bottom-right). The light shadow simulates light reflection, while the dark shadow simulates a cast shadow.

Dark Shadow (bottom-right)

8px 8px 16px #bebebe

Positive X and Y values push shadow down-right

Light Shadow (top-left)

-8px -8px 16px #ffffff

Negative X and Y values push shadow up-left

CSS
.neu-button {
  background: #e0e0e0;
  box-shadow:
    8px 8px 16px #bebebe,    /* Dark shadow */
    -8px -8px 16px #ffffff;  /* Light shadow */
}

3Add Border Radius

Neumorphism works best with rounded corners. A border-radius of 10-20px creates a soft, modern look. Remove any default borders.

CSS
.neu-button {
  background: #e0e0e0;
  border-radius: 12px;
  border: none;
  padding: 12px 24px;
  box-shadow:
    8px 8px 16px #bebebe,
    -8px -8px 16px #ffffff;
}

4Create the Pressed/Active State

For the pressed state, use inset shadows. This makes the button appear to be pushed into the surface.

Raised effect
Inset effect
CSS
.neu-button:active {
  box-shadow:
    inset 4px 4px 8px #bebebe,
    inset -4px -4px 8px #ffffff;
}

5Add Hover Transition

Add a smooth transition and a subtle hover effect. Reducing the shadow distance on hover creates a nice "lifting" sensation.

Complete CSS
.neu-button {
  background: #e0e0e0;
  border-radius: 12px;
  border: none;
  padding: 12px 24px;
  box-shadow:
    8px 8px 16px #bebebe,
    -8px -8px 16px #ffffff;
  transition: all 0.2s ease;
}

.neu-button:hover {
  box-shadow:
    6px 6px 12px #bebebe,
    -6px -6px 12px #ffffff;
}

.neu-button:active {
  box-shadow:
    inset 4px 4px 8px #bebebe,
    inset -4px -4px 8px #ffffff;
}

Interactive Demo

Experiment with different shadow settings to see how they affect the neumorphism effect. Click the button to see the active state.

8px
16px
Generated CSS
.neu-button {
  background: #e0e0e0;
  border-radius: 12px;
  border: none;
  padding: 12px 24px;
  box-shadow:
    8px 8px 16px #bebebe,
    -8px -8px 16px #ffffff;
  transition: all 0.2s ease;
}

.neu-button:hover {
  box-shadow:
    6px 6px 12px #bebebe,
    -6px -6px 12px #ffffff;
}

.neu-button:active {
  box-shadow:
    inset 4px 4px 8px #bebebe,
    inset -4px -4px 8px #ffffff;
}

Neumorphism Variations

Convex

Gradient makes it look rounded/bulging

Concave

Reversed gradient for dished look

Flat

Standard flat surface effect

Variations CSS
/* Convex - bulging outward */
.neu-convex {
  background: linear-gradient(145deg, #f0f0f0, #cacaca);
  box-shadow: 5px 5px 10px #bebebe, -5px -5px 10px #ffffff;
}

/* Concave - dished inward */
.neu-concave {
  background: linear-gradient(145deg, #cacaca, #f0f0f0);
  box-shadow: 5px 5px 10px #bebebe, -5px -5px 10px #ffffff;
}

/* Flat - standard */
.neu-flat {
  background: #e0e0e0;
  box-shadow: 5px 5px 10px #bebebe, -5px -5px 10px #ffffff;
}

Color Variations

Neumorphism works on any background color. Just calculate shadow colors that are slightly lighter and darker than your base.

Light Background

Base: #e0e5ec

Dark Background

Base: #2d2d2d

Theme CSS
/* Light theme */
.light-theme {
  background: #e0e5ec;
}
.light-theme .neu-button {
  background: #e0e5ec;
  box-shadow:
    9px 9px 16px rgba(163,177,198,0.6),
    -9px -9px 16px rgba(255,255,255,0.5);
}

/* Dark theme */
.dark-theme {
  background: #2d2d2d;
}
.dark-theme .neu-button {
  background: #2d2d2d;
  color: #f0f0f0;
  box-shadow:
    8px 8px 16px #262626,
    -8px -8px 16px #343434;
}

Want More Neumorphism Button Examples?

Browse our collection of 20+ ready-to-use neumorphism button styles. Click any button to copy the CSS instantly.

View Neumorphism Button Examples

Frequently Asked Questions

What is neumorphism in UI design?

Neumorphism (also called soft UI) is a design style that combines flat design with skeuomorphism. It creates the illusion that UI elements are extruded from or pressed into the background using soft shadows. The effect is achieved with two shadows: a light shadow on one side and a dark shadow on the opposite side, giving elements a soft, 3D appearance.

Why do neumorphism buttons need a matching background?

Neumorphism relies on the illusion that the button is part of the same surface as the background. If the button and background colors differ, the shadows won't create the characteristic 'extruded' or 'pressed' look. The light and dark shadows need to blend naturally with the background to maintain the soft, realistic effect.

How do I make neumorphism work on dark backgrounds?

For dark backgrounds, swap your shadow colors. Use a slightly lighter color for the highlight shadow and a darker color for the shadow. For example, on a #2d2d2d background, use shadows like '8px 8px 16px #262626' for the dark shadow and '-8px -8px 16px #343434' for the light shadow. The principle remains the same: one lighter, one darker than the base.

Is neumorphism accessible?

Neumorphism can have accessibility challenges. The low contrast between elements and backgrounds can make it difficult for users with visual impairments to distinguish interactive elements. To improve accessibility: ensure sufficient color contrast for text, add clear focus states with outlines, consider adding subtle borders for definition, and test with users who have different visual abilities.

What's the difference between neumorphism and skeuomorphism?

Skeuomorphism mimics real-world objects with detailed textures, gradients, and realistic effects (like Apple's old iOS icons). Neumorphism is more subtle and abstract, it doesn't try to look like a real physical object but rather creates a soft, extruded look from a flat surface using only shadows. Neumorphism is essentially a minimalist evolution of skeuomorphism.