Skip to content

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy
CSS

CSS: Create Neumorphism with Box Shadows

- 02.08.26 - ErcanOPAK

🟣 Neumorphism = Soft UI Design

Neumorphism blends skeuomorphism and flat design. Box shadows create the soft, extruded look that makes UIs feel tactile and modern.

📝 Neumorphism Components

// Neumorphism Base
.neumorph {
    background: #e0e5ec;
    border-radius: 16px;
    box-shadow: 
        8px 8px 16px rgba(163,177,198,0.6),
        -8px -8px 16px rgba(255,255,255,0.5);
}

// Neumorphism Inset (Pressed)
.neumorph-inset {
    background: #e0e5ec;
    border-radius: 16px;
    box-shadow: 
        inset 8px 8px 16px rgba(163,177,198,0.6),
        inset -8px -8px 16px rgba(255,255,255,0.5);
}

// Neumorphism Card
.neumorph-card {
    background: #e0e5ec;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 
        12px 12px 24px rgba(163,177,198,0.6),
        -12px -12px 24px rgba(255,255,255,0.5);
    transition: all 0.3s ease;
}

.neumorph-card:hover {
    box-shadow: 
        6px 6px 12px rgba(163,177,198,0.6),
        -6px -6px 12px rgba(255,255,255,0.5);
    transform: translateY(-2px);
}

// Neumorphism Button
.neumorph-button {
    background: #e0e5ec;
    border: none;
    border-radius: 50px;
    padding: 12px 32px;
    font-weight: 600;
    color: #2c3e50;
    box-shadow: 
        6px 6px 12px rgba(163,177,198,0.6),
        -6px -6px 12px rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.15s ease;
}

.neumorph-button:active {
    box-shadow: 
        inset 6px 6px 12px rgba(163,177,198,0.6),
        inset -6px -6px 12px rgba(255,255,255,0.5);
    transform: scale(0.98);
}

// Colored Neumorphism
.blue-neumorph {
    background: #d4e4f7;
    box-shadow: 
        8px 8px 16px rgba(139, 178, 227, 0.6),
        -8px -8px 16px rgba(255, 255, 255, 0.5);
}

// Dark Mode Neumorphism
.dark-neumorph {
    background: #2d3748;
    box-shadow: 
        8px 8px 16px rgba(0,0,0,0.4),
        -8px -8px 16px rgba(255,255,255,0.05);
}

🎯 Interactive Neumorphism

// Toggle Switch Neumorphism
.neumorph-toggle {
    display: inline-block;
    width: 60px;
    height: 30px;
    background: #e0e5ec;
    border-radius: 30px;
    box-shadow: 
        inset 3px 3px 6px rgba(163,177,198,0.6),
        inset -3px -3px 6px rgba(255,255,255,0.5);
    position: relative;
    cursor: pointer;
}

.neumorph-toggle .slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: #e0e5ec;
    border-radius: 50%;
    box-shadow: 
        3px 3px 6px rgba(163,177,198,0.6),
        -3px -3px 6px rgba(255,255,255,0.5);
    transition: all 0.3s ease;
}

.neumorph-toggle.active .slider {
    left: 33px;
    background: #4CAF50;
}

// Neumorphism Gallery
.neumorph-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 30px;
    padding: 30px;
}

.neumorph-item {
    background: #e0e5ec;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    box-shadow: 
        6px 6px 12px rgba(163,177,198,0.6),
        -6px -6px 12px rgba(255,255,255,0.5);
}

// Loading Spinner Neumorphism
.neumorph-spinner {
    width: 50px;
    height: 50px;
    background: #e0e5ec;
    border-radius: 50%;
    box-shadow: 
        inset 4px 4px 8px rgba(163,177,198,0.6),
        inset -4px -4px 8px rgba(255,255,255,0.5);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

// Neumorphism Form
.neumorph-input {
    background: #e0e5ec;
    border: none;
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: 
        inset 4px 4px 8px rgba(163,177,198,0.6),
        inset -4px -4px 8px rgba(255,255,255,0.5);
    font-size: 16px;
    outline: none;
    width: 100%;
}

.neumorph-input:focus {
    box-shadow: 
        inset 4px 4px 12px rgba(163,177,198,0.8),
        inset -4px -4px 12px rgba(255,255,255,0.3);
}

💡 Neumorphism Best Practices

  • Use subtle shadows for a soft look
  • Choose appropriate background colors
  • Maintain accessibility with contrast
  • Use insets for pressed/active states
  • Keep consistency across the UI

Neumorphism creates a unique tactile experience. The soft shadows make interfaces feel physical and approachable.

— UI Designer

Related posts:

CSS — aspect-ratio Fixes Responsive Media Instantly

CSS — display: none Skips Layout but Breaks Animations

CSS Layouts Break on Large Screens Only

Post Views: 2

Post navigation

Windows 11: Automate Clipboard with PowerToys
JavaScript: Build Search Engine with Array Methods

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

October 2026
M T W T F S S
 1234
567891011
12131415161718
19202122232425
262728293031  
« Sep    

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (973)
  • How to make theater mode the default for Youtube (953)
  • How to add default value for Entity Framework migrations for DateTime and Bool (939)
  • Get the First and Last Word from a String or Sentence in SQL (847)
  • How to select distinct rows in a datatable in C# (837)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (624)
  • Add Constraint to SQL Table to ensure email contains @ (590)
  • Average of all values in a column that are not zero in SQL (553)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (526)
  • Find numbers with more than two decimal places in SQL (468)

Recent Posts

  • CSS: Fix a prefers-color-scheme Media Query That Gets Silently Overridden by a Browser Extension’s Forced Dark Mode
  • Git: Fix a Merge Commit That Silently Drops a File Because Both Branches Deleted It Differently
  • HTML5: Fix a Native Lazy-Loading Image That Never Loads Because It Sits Inside a Hidden Tab Until the User Clicks It
  • The AI Prompt That Traces a Null Reference Exception Back to the Exact Line That First Produced the Null
  • The AI Prompt That Turns a Gym Membership Contract’s Fine Print Into a Plain-English List of Cancellation Steps
  • Photoshop: Fix a Color Profile Mismatch That Makes Printed Output Look Nothing Like What You Saw On Screen
  • WordPress: Fix Search Results That Return Pages From a Theme You Deactivated Months Ago
  • Visual Studio: Fix a Test Project That Builds Fine Alone but Fails to Discover Any Tests After a NuGet Restore
  • ASP.NET Core: Fix a File Upload That Times Out on Slow Connections Only Because Kestrel’s Minimum Data Rate Feature Kicked In
  • JavaScript: Fix an Array Destructuring Default Value That Silently Never Applies Because null Was Passed Instead of Undefined

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (973)
  • How to make theater mode the default for Youtube (953)
  • How to add default value for Entity Framework migrations for DateTime and Bool (939)
  • Get the First and Last Word from a String or Sentence in SQL (847)
  • How to select distinct rows in a datatable in C# (837)

Recent Posts

  • CSS: Fix a prefers-color-scheme Media Query That Gets Silently Overridden by a Browser Extension’s Forced Dark Mode
  • Git: Fix a Merge Commit That Silently Drops a File Because Both Branches Deleted It Differently
  • HTML5: Fix a Native Lazy-Loading Image That Never Loads Because It Sits Inside a Hidden Tab Until the User Clicks It
  • The AI Prompt That Traces a Null Reference Exception Back to the Exact Line That First Produced the Null
  • The AI Prompt That Turns a Gym Membership Contract’s Fine Print Into a Plain-English List of Cancellation Steps

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com