HTML CSS Bootstrap JavaScript jQuery MySQL PHP Data Mining

Bootstrap Shadows

Written by RedoHub Team · Last updated: August 1, 2026

Bootstrap includes a handful of utility classes to add a box-shadow to elements quickly. In modern web design, shadows simulate elevation (the Z-axis). Adding a shadow makes an element appear as if it is floating slightly above the page.


Elevation Levels

Bootstrap provides three distinct sizes of drop-shadows. You simply apply the corresponding class to generate a sense of depth.

  • .shadow-sm: A subtle, small shadow. Often used for generic form inputs or buttons.
  • .shadow: The standard, regular shadow. Great for cards and small UI panels.
  • .shadow-lg: A massive, diffuse shadow. Used for things that float high above the page, like dropdown menus or popup modals.
No shadow applied
Small shadow (.shadow-sm)
Regular shadow (.shadow)
Large shadow (.shadow-lg)
<!-- A subtle, low-elevation shadow -->
<div class="shadow-sm bg-white rounded"></div>

<!-- The standard shadow size -->
<div class="shadow bg-white rounded"></div>

<!-- A large, highly elevated shadow -->
<div class="shadow-lg bg-white rounded"></div>

Removing Shadows

Sometimes you might use a generic Bootstrap component that inherently has a shadow (like certain Navbar styling or Cards), but you want to make it perfectly flat.

To explicitly delete any box-shadow from an element, just append the .shadow-none utility class.

I have the .shadow-none class explicitly removing all shadows!
<!-- Strip any shadow styling off this element completely -->
<div class="shadow-none p-3 bg-white rounded">Completely Flat</div>

Common Mistakes to Avoid

Stacking .shadow classes on top of each other. Only one shadow-size class takes effect per element — applying both .shadow-sm and .shadow-lg together just lets the later CSS rule win, which is confusing to debug later.
Using shadows on a dark background without checking contrast. Bootstrap's default shadow colors are subtle grays tuned for light backgrounds — they can be nearly invisible on dark UI, making the "elevation" effect disappear.
Adding shadows to every single element "for depth." Overusing shadows flattens their visual meaning — reserve them for elements that genuinely need to stand out, like modals, dropdowns, and cards.

Try It: A Card That Lifts on Hover

A second example — combining a small shadow with Bootstrap's shadow utilities to suggest interactivity:

<div class="card shadow-sm p-3" style="max-width: 300px;">
    <h5 class="card-title">Pricing Plan</h5>
    <p class="card-text">A subtle shadow makes this card feel clickable.</p>
</div>

Frequently Asked Questions

Q: Can I customize the exact shadow color and blur?

A: Not with the utility classes alone — those are fixed presets. For custom shadow values, write your own CSS box-shadow rule or override Bootstrap's Sass variables when compiling from source.

Q: Do shadow classes affect layout or just visuals?

A: Purely visual — box-shadow never affects an element's size or position in the page flow, unlike a border.

Q: Are there responsive versions of the shadow classes?

A: No — shadow utilities are not breakpoint-specific in core Bootstrap. See the official Shadows documentation for the complete class list.