The box-shadow property is one of CSS’s most versatile tools - capable of adding depth, realism, and focus to your designs with just a few lines of code. In this collection, you’ll find a wide range of box-shadow examples: from soft, natural shadows and elegant hover effects to dramatic layered looks and neon-style glows. Using clever combinations of offsets, blur, spread, and color, these examples show how shadows can transform buttons, cards, modals, and more into polished, visually striking elements.
83 CSS box-shadow Examples
Hand-Drawn Retro Radio Group
demo & codeThis Hand-Drawn Retro Radio Group injects personality into standard forms with a nostalgic, sketchbook aesthetic. It combines a “neo-brutalist” shadow style with subtle animations - like text jitter and a bouncing selection dot - to mimic the imperfection of hand-drawn art. The background features a CSS-generated paper texture and scanline effect, making it ideal for indie game interfaces, creative blogs, or retro-themed landing pages.
Animated Futuristic State Button
demo & codeThis Animated Futuristic State Button is more than just a clickable element; it’s a self-contained micro-interaction. Designed for actions like “Generate” or “Processing,” it features a idle flicker animation that transitions into an intense, glowing state upon focus. The text cleverly swaps from a call-to-action to a continuous verb (“Generate” → “Generating”) using purely CSS animations, providing immediate visual feedback without JavaScript.
Skeuomorphic Wood Texture Toggles
demo & codeThis collection of Skeuomorphic Wood Texture Toggles brings a tactile, nostalgic feel to digital interfaces. It showcases four distinct variations of toggle switches (sliding, dotted handle, separated track, and embedded text), all unified by a realistic wood grain texture and intricate lighting effects. The implementation demonstrates the power of modern CSS features like :has() to control complex state changes without a single line of JavaScript.
Neumorphic Dark Mode Calculator
demo & codeThis Neumorphic Dark Mode Calculator brings the “Soft UI” trend to life with a fully functional mathematical tool. It features a realistic, extruded plastic look achieved through complex CSS box-shadows. A prominent toggle allows users to switch between a clean light theme and a high-contrast dark mode, instantly updating the shadow physics to maintain the illusion of depth.
Bicycle
A pure CSS bicycle illustration constructed from geometric primitives using absolute positioning and vmin units for responsiveness. conic-gradient simulates wheel spokes, transform: skewX shapes the frame, and inset box-shadow adds depth, while pseudo-elements efficiently duplicate components like wheels.
See the Pen Bicycle.
Dipper Pines from Gravity Falls
A pure CSS character illustration of Dipper Pines, constructed from geometric primitives using absolute positioning and vmin units for responsiveness. The design leverages border-radius, transform, clip-path masking, and pseudo-elements to shape detailed features like the signature pine tree hat and hair, all styled with CSS variables and a custom web font.
See the Pen Dipper Pines from Gravity Falls.
Giraffe
A pure CSS cartoon illustration of a giraffe constructed from geometric primitives using absolute positioning. It leverages box-shadow for efficient pattern repetition (spots, clouds), clip-path for complex shapes like the mane, and CSS variables for a consistent pastel color palette.
See the Pen Giraffe.
Line House
A pure CSS illustration of a house constructed from geometric primitives using clip-path for complex shapes and transform for perspective. It features a warm color palette managed via CSS variables, extensive drop-shadow usage for foliage density, and linear-gradient for detailed window reflections.
See the Pen Line House.
Warrior
A pure CSS illustration of a knight constructed from geometric primitives. It employs repeating-linear-gradient for shield textures, clip-path for armor shaping, and extensive box-shadow duplication to render limbs and details efficiently, creating a stark, high-contrast monochrome aesthetic.
See the Pen Warrior.
Neumorphic Loader
A tactile Neumorphic progress indicator where JavaScript drives the animation state by updating a custom property --progress. The visual logic relies on CSS conic-gradient utilizing calculated color stops to dynamically render the filling arc, while complex layered box-shadow creates a soft, extruded 3D aesthetic.
See the Pen Neumorphic Loader.
Soft Button Styling
A collection of skeuomorphic buttons rendered entirely in CSS using complex gradient layering and calc()-driven geometry variables.
See the Pen Soft Button Styling.
To-Do List
A stylized paper notepad To-Do list featuring a skew transformation and stack-effect shadows. Clicking checkboxes toggles a strikethrough style on handwritten list items via JavaScript class manipulation.
See the Pen To-Do List.
Connect Four in Vue and CSS
A full-stack, reactive implementation of Connect Four built on Vue.js, featuring complex game logic including victory checks across four axes and keyboard accessibility.
See the Pen Connect Four in Vue and CSS.
Ergonomic Toggle (CSS)
A hyper-realistic skeuomorphic toggle switch crafted entirely in CSS using advanced box-shadows and gradients to simulate depth and lighting.
See the Pen Ergonomic Toggle (CSS).
Range Slider
A highly stylized range slider utilizing box-shadow on the slider thumb to render the track, masked by a clip-path polygon on the parent container to create a unique slanted aesthetic.
See the Pen Range Slider.
React Radio Player
A tactile, interactive player that looks and behaves like a real gadget, featuring smooth power-on animations and live audio streaming.
See the Pen React Radio Player.
Creative Section Design
A visually rich, animated section with cards that respond to hover (a colored border appears), creating a sense of interactivity and depth.
See the Pen Creative Section Design.
Pure CSS Dark Mode Toggle Switch
This is a toggle switch that allows selecting between skeuomorphic and neumorphic design styles. It also features a dark/light theme change triggered by toggling the switch itself.
See the Pen Pure CSS Dark Mode Toggle Switch.
Metallic Skeuomorphic Toggle Switches
A skeuomorphic toggle design achieved by combining multiple linear-gradients for the body and box-shadow to create a volumetric effect. The smooth switching animation and “glow” in the active state are implemented via transition with a custom cubic-bezier curve.
See the Pen Metallic Skeuomorphic Toggle Switches.
3D Neon Toggle On/Off Switch
An advanced 3D toggle switch simulating a physical button with a neon glow. The effect is implemented in pure CSS using an <input type="checkbox">, and the state transition (ON/OFF) is achieved through a complex interplay of box-shadow and 3D transforms.
See the Pen 3D Neon Toggle On/Off Switch.
3D Toggle On/Off Switch v2
The use of gradients to create a realistic metallic effect and highlights on the button. Various types of linear-gradient and radial-gradient are applied to create a multi-layered background, and clip-path precisely clips the shapes of the pseudo-elements.
See the Pen 3D Toggle On/Off Switch v2.
Checkbox Hamburger Menu Animation
A demonstration of step-by-step CSS transformation to create a cross effect: on :checked, the middle bar either gets opacity: 0 or scales down, while the top and bottom bars simultaneously rotate and translate.
See the Pen Checkbox Hamburger Menu Animation.
CSS Day/Night Lighthouse Illustration
A purely CSS rendering of a complex lighthouse scene at sunset/night. The “checkbox hack” is used to toggle between day and night modes. All graphics - from the lighthouse itself to the sea, clouds, and stars - are created exclusively using CSS gradients and box-shadow.
See the Pen CSS Day/Night Lighthouse Illustration.
CSS Style Switcher with :has()
An example of powerful reactivity with :has() - theme switching not only changes colors but also radically reworks the layout, adds stylized shadows, and even changes fonts and background SVG patterns.
See the Pen CSS Style Switcher with :has().
Dark Mode Toggle Switch
A toggle switch implemented using a single <input type="checkbox"> and pseudo-elements. The “button” effect and its movement are achieved through complex, multi-layered box-shadow and the shifting of the ::before element.
See the Pen Dark Mode Toggle Switch.
Neon Icon Hover Effect
A navigation menu with a neon glow and a complex hover effect. Icons and text use the CSS drop-shadow filter to create a glow effect, while the element’s color is controlled via an inline CSS variable --clr.
See the Pen Neon Icon Hover Effect.
Single Div CSS Computer
A demonstration of pixel art creation using only CSS gradients and box-shadow animation, without a single image file or extra HTML elements.
See the Pen Single Div CSS Computer.
Glowing On/Off Buttons
A skeuomorphic toggle button where the entire press effect is implemented in pure CSS using box-shadow and transform: scale(). JavaScript is only used to toggle the WAI-ARIA attribute aria-pressed on click.
See the Pen Glowing On/Off Buttons.
3D Capsule Slider Button
A combination of the ‘checkbox hack’ and 3D transforms to create an interactive neumorphism-style switcher. JavaScript only adds classes, while the entire transform: rotateX() animation and complex box-shadow are controlled by CSS.
See the Pen 3D Capsule Slider Button.
FAQ Accordion with Font Awesome Icons
The “Accordion/FAQ” functionality is implemented using pure JavaScript, which handles the click on the parent element and toggles the active class on the FAQ container. The visual highlight is the icon change via CSS display: none/block properties.
See the Pen FAQ Accordion with Font Awesome Icons.
Neumorphic Multi-Buttons with CSS Feedback
An effective button group where the hover effect is created via inset box-shadow - and the click confirmation animation is implemented using transform and opacity on the ::after pseudo-element.
See the Pen Neumorphic Multi-Buttons with CSS Feedback.
Realistic MPK Mini MIDI Controller in Pure CSS
Pure CSS skeuomorphism in action - a complete replica of a MIDI controller where every knob, pad, and key is drawn by layering dozens of gradients and shadows.
See the Pen Realistic MPK Mini MIDI Controller in Pure CSS.
Soft UI Counter Component
This simple counter demonstrates clean vanilla JavaScript functionality: counter management, class switching for instant color scheme change based on the number’s sign. The stylistic focus is on “Soft UI” aesthetics.
See the Pen Soft UI Counter Component.
Neumorphic Soft UI Radio Buttons and Checkboxes
This demo explores the Neumorphic or Soft UI design trend, implementing a complete set of custom radio buttons, checkboxes, and toggle switches using only pure CSS box-shadow properties to achieve the signature concave/convex 3D-like effect, while a concise Vanilla JS script manages the dynamic background gradient on state change.
See the Pen Neumorphic Soft UI Radio Buttons and Checkboxes.
Button with Animated Gradient
Achieve a premium, vibrant glow and pulsating background with this component, which utilizes high-performance CSS animations and dynamic box-shadow effects, all orchestrated by TypeScript and the GSAP library.
See the Pen Button with Animated Gradient.
Vertical Rocker Switch
A tactilely realistic vertical toggle, created using advanced CSS variable techniques and multiple box-shadow layers to mimic three-dimensional depth, combined with smooth cubic-bezier animations.
See the Pen Vertical Rocker Switch.
Neuomorphic Fingerprint Scanner
A complex 3D effect with a deep glow, achieved by combining multiple box-shadow and radial-gradient styles. Key feature: layered fingerprint scanning using two SVG elements and the clever application of mix-blend-mode.
See the Pen Neuomorphic Fingerprint Scanner.
Basic CSS Snippets: Double Borders
This demo is a visual guide to creating double borders and frames using pure CSS. It showcases elegant and flexible approaches with box-shadow, outline, and CSS variables, making the code clean and easily customizable.
See the Pen Basic CSS Snippets: Double Borders.
Striped Box Shadow Effect
The demo focuses on using CSS gradients to generate background patterns. Instead of relying on images, it creates a complex, repeating design with linear-gradient and background-size, which ensures high performance and flexibility in resizing the pattern.
See the Pen Striped Box Shadow Effect.
Earth with Pure CSS
A showcase of advanced CSS capabilities for creating stunning 2D animations. It uses CSS @property for smooth property transitions, allowing you to animate box-shadow and other elements without compromising performance.
See the Pen Earth with Pure CSS.
Card with Glitch Effect
This Cyberpunk-inspired card features a complex box-shadow offset and text-shadow for the core CRT aesthetic, paired with a dynamic :hover state that uses transform to instantly swap the terminal view for a social icon grid.
Glass Effect UI
An elegant UI element using the “frosted glass” effect (backdrop-filter), enhanced with complex box-shadow and pseudo-elements for depth and a realistic, shimmering glare.
Climbing Cube
An illusion of an endlessly rolling 3D cube, achieved by synchronizing two @keyframes animations for rotation and sliding with an offset transform-origin. The complex rotation animation uses intermediate steps for a “bounce” effect, while a neon glow and -webkit-box-reflect complete the futuristic look.
Push Button (CSS 3D Button)
A skeuomorphic 3D button created with multi-layered box-shadow and linear-gradient to simulate volume, highlights, and shadows. On :hover, the box-shadow styles are animated, creating a “pressed” effect.
Inverted Border Boxes
A demonstration of a non-trivial technique for creating inverted rounded corners using ::before pseudo-elements and box-shadow. This trick allows you to “carve out” complex shapes from parent blocks, bypassing the limitations of standard border-radius.
See the Pen Inverted Border Boxes.
Bootstrap 5 Accordion Example
A customized Bootstrap 5 accordion that visually elevates the active panel using the modern :has() pseudo-class. By detecting the .accordion-button:not(.collapsed) state, it applies a bold border and hard shadow to the parent container, creating a distinct “pop-out” focus effect.
See the Pen Bootstrap 5 Accordion Example.
Eye-Catching Bootstrap 5 Button
A vibrant CTA button featuring a neon linear gradient and a continuous ‘shine’ animation implemented via a moving radial gradient on the ::before pseudo-element. On hover, it scales up and intensifies its colored drop-shadow for enhanced interactivity.
See the Pen Eye-Catching Bootstrap 5 Button.
ctrl+c ctrl+v Keys RGB
A decorative keyboard with a realistic press effect and dynamic, iridescent RGB backlighting, reminiscent of gaming keyboards.
See the Pen ctrl+c ctrl+v Keys RGB.
Neuromorphic Keyboard
A sleek neuromorphic keyboard UI crafted entirely with CSS Grid and Pug. The design leverages layered box-shadow properties to create the signature soft, extruded button effect, while :hover and :active pseudo-classes simulate tactile key presses.
Credit Card Checkout
This JS-free form component achieves a distinct “neo-brutalist” aesthetic by pairing a solid border with a hard, offset box-shadow, creating a tactile, pseudo-3D effect. This visual system is applied to a modern Flexbox layout and is enhanced by polished micro-interactions, including a unique box-shadow outline on :hover and a clear background change on :focus for a cohesive user experience.
See the Pen Credit Card Checkout.
Border Form
This demo blends a modern, adaptive layout powered by CSS Grid with a striking visual style. The fluid grid structure is populated by chunky form elements, whose pseudo-3D depth is crafted by pairing a thick border with a solid-color box-shadow, demonstrating a complete UI solution in pure CSS.
See the Pen Border Form.