How to Create Perfect CSS Box Shadows for Dropdowns and Popovers
Dropdowns and popovers are some of the most common floating elements in web design. They appear above other content, so they need shadows to establish that layering. But they're not as dramatic as modals—they still feel connected to the page and the button that triggered them. Getting the shadow right means balancing elevation with restraint.
The difference between a good dropdown shadow and a bad one often comes down to a few CSS values. Too much blur or darkness, and the dropdown feels disconnected and heavy. Too little, and it might blend into the page. A CSS box shadow generator lets you tweak these values visually until the shadow feels exactly right for your interface.
Why Dropdowns and Popovers Need Shadows
When a dropdown or popover appears on the screen, it needs to feel like it's sitting above the page, not part of it. Users don't think consciously about shadows, but they notice when something looks "off." A dropdown without a shadow can look flat and stuck to the background. A shadow gives it dimension and makes it feel interactive.
Think about a navigation menu in a web app. The main navigation bar sits at the top, and when you click "Settings," a dropdown appears. If that dropdown has no shadow, it might look like a weird visual glitch—like the content got cut off or something went wrong. With a proper shadow, users immediately understand that a new layer has appeared and they can interact with it.
Popovers work the same way. A tooltip that appears when you hover over an element, a popover menu next to a button, or a date picker that floats above a form input—all of these benefit from a shadow that says "I'm on top of things."
Key Shadow Parameters for Dropdowns
The best dropdown shadows share some characteristics. They're not random—they follow a design pattern that works across most interfaces.
X offset should be zero or minimal. Most dropdowns and popovers appear directly below or beside a trigger element. You don't want the shadow to suggest the element is floating to the left or right. Keep X at 0px for clean, vertical alignment.
Y offset should be small to medium. The shadow needs to suggest vertical distance, but dropdowns aren't as high as modals. An offset between 4px and 12px works well. If you're creating a popover that appears beside an element instead of below it, adjust accordingly, but keep it moderate.
Blur should be medium. This is where dropdown shadows differ from card shadows. Cards often use subtle blur (around 12px to 16px), but dropdowns can handle a bit more—try 16px to 24px. This creates a softer, slightly more prominent shadow that helps the dropdown feel clearly separated from the background content.
Spread should be zero or slightly negative. A spread of 0px is standard. A slightly negative spread (like -4px or -8px) can create a cleaner edge if your dropdown is rectangular. Positive spread usually isn't necessary for dropdowns unless you're going for a special effect.
Opacity should be low to medium. This is critical. A dropdown shadow should not be as intense as a modal shadow. Keep opacity between 0.12 and 0.24 for a shadow that feels present without being aggressive. If your dropdown appears on a very light background, you might push toward 0.24. On a medium background, 0.15 to 0.18 often works better.
Ready-to-Use CSS Box Shadow Examples
Here are four dropdown and popover shadows that work well in most modern interfaces:
Subtle dropdown shadow
box-shadow: 0px 4px 12px 0px rgba(15, 23, 42, 0.15);
Use this for dropdowns and popovers in clean, minimal interfaces. It provides enough separation without being visually heavy. Good for navigation menus, select dropdowns, and small popovers.
Medium dropdown shadow
box-shadow: 0px 8px 20px 0px rgba(15, 23, 42, 0.18);
This is a step up from subtle. Use it when your dropdown needs more visual prominence—for larger menus, multi-level dropdowns, or interfaces where dropdowns appear frequently and need clear distinction.
Dropdown with negative spread
box-shadow: 0px 8px 20px -4px rgba(15, 23, 42, 0.20);
The negative spread creates a more contained shadow that doesn't spread as far. This works especially well for rectangular dropdowns where you want the shadow to hug the edges more tightly.
Floating popover shadow
box-shadow: 0px 12px 28px -6px rgba(15, 23, 42, 0.22);
Use this for popovers that need more presence than a dropdown—date pickers, larger tooltips, or command menus. The larger Y offset and negative spread create a shadow that feels elevated but still intimate.
How Dropdown Shadows Differ from Other Shadows
Cards, modals, buttons, and inputs all use shadows, but they're tuned differently. Understanding these differences helps you choose the right values.
Cards typically use subtle shadows because pages might have many cards. A card shadow is often the lightest in the hierarchy. Example: 0px 4px 16px 0px rgba(0, 0, 0, 0.12).
Modals need stronger shadows because they demand attention and sit well above the page. Modal shadows often use more blur and darkness. Example: 0px 24px 64px -16px rgba(0, 0, 0, 0.36).
Dropdowns and popovers sit between these two. They're elevated but still feel part of the local context. They're stronger than a card shadow but lighter than a modal.
Buttons might have subtle shadows to suggest clickability, or stronger shadows on hover to show interaction. Button shadows are often the most minimal.
This hierarchy helps users understand the visual structure of your interface. When shadows are inconsistent, the interface feels chaotic.
Testing Your Dropdown Shadow
A dropdown shadow's effectiveness depends on context. A shadow that looks perfect on a white background might disappear on light grey or feel too heavy on a darker background. Use the shadow generator tool to test your dropdown shadow against the actual colors you'll use.
Here's a practical testing approach:
1. First, set the background color to the actual color behind your dropdown. If your dropdown usually appears over page content with a white background, use white. If it appears over a slightly darker section, match that.
2. Set the box color to the dropdown's actual background color. Most dropdowns are white, but some interfaces use off-white, light grey, or even darker colors.
3. Adjust the shadow until it creates clear separation. You should easily see where the dropdown begins and the background ends.
4. Then test on a different background. Is the shadow still visible? Does it feel heavy or natural? Adjust opacity if needed.
5. If your dropdown appears in multiple contexts (over different background colors), test all of them. You might find you need to adjust the shadow values slightly depending on where it's used.
Real-world testing beats guessing. A shadow that looks great in isolation might feel different when surrounded by actual content.
Dropdown Shadows in Dark Mode
Dark mode requires different shadow values. On a dark background, a pure black shadow becomes invisible. Instead, you need to adjust both color and opacity.
For dark mode dropdowns, consider these approaches:
Use a lighter shadow color instead of black. Try rgba(255, 255, 255, 0.15) or rgba(200, 200, 200, 0.12). This creates a subtle glow effect that suggests elevation.
Alternatively, use a slightly transparent version of your dropdown's background color. If your dropdown is a dark grey like #1a1a1a, try a shadow with the same color but low opacity: rgba(26, 26, 26, 0.08).
Combine shadows with subtle borders or background contrast. A dark dropdown against a dark background often benefits from a thin border in addition to a light shadow. The border and shadow together create enough separation.
Dark mode shadows often feel less dramatic than light mode shadows, and that's okay. The goal is clarity, not visual punch.
Common Mistakes with Dropdown Shadows
Using the same shadow for everything. A shadow that works for a dropdown might not work for a modal or card. Each element type needs its own tuned value.
Opacity too high. A common instinct is to make the shadow darker so it's more visible. But a high-opacity shadow looks heavy and dated. A lower-opacity shadow with more blur usually looks better.
Forgetting to test on the actual background. Dropdowns appear over page content, so test your shadow against that content. A shadow that looks good in isolation might disappear or look wrong in context.
Ignoring the Y offset. Some people set X and Y both to 0px to center the shadow. But dropdowns feel most natural with a downward offset that suggests they're sitting below the trigger element.
Making it too similar to modals. A dropdown shadow should not feel as heavy as a modal shadow. If your dropdown shadow is almost as strong as your modal shadow, the visual hierarchy breaks down. Keep dropdowns lighter.
Adjusting Shadow for Different Dropdown Types
Not all dropdowns are the same. A select dropdown in a form is different from a navigation menu, which is different from a command palette. Adjust your shadow based on the context.
Form dropdowns (select menus, date pickers) often benefit from subtle shadows. These are functional elements that shouldn't dominate the page. Try values in the 0px 4px 12px range.
Navigation menus can handle slightly stronger shadows, especially if they're multi-level. A navigation menu is a key feature, so a shadow in the 0px 8px 20px range often works well.
Popovers and tooltips vary by size. A small tooltip might use a subtle shadow, while a large popover with rich content can use something closer to a medium shadow.
Command palettes and search menus often feel more prominent and can use stronger shadows, similar to modals but not quite as intense. Try values around 0px 12px 32px -8px.
The tool lets you adjust and preview these differences instantly. Find the shadow that matches your specific use case.
Multiple Dropdowns and Visual Consistency
If your interface has several types of dropdowns, keep the shadows consistent. If a navigation dropdown, a form select dropdown, and a user menu all use different shadows, the interface feels disorganized.
A simple approach is to use one or two standard dropdown shadows:
- Light dropdown shadow for subtle form elements and small popovers
- Medium dropdown shadow for menus and larger interactive elements
This keeps your code DRY (don't repeat yourself) and your interface feeling coherent.
Animating Dropdown Shadows
Shadows can change on interaction. When a dropdown opens, you might start with no shadow and fade it in. When a user hovers near a dropdown, you might increase the shadow slightly to show it's interactive.
CSS transitions make this smooth:
.dropdown {
box-shadow: 0px 4px 12px 0px rgba(15, 23, 42, 0.15);
transition: box-shadow 0.2s ease;
}
.dropdown:hover {
box-shadow: 0px 8px 20px 0px rgba(15, 23, 42, 0.20);
}
This creates a subtle but satisfying effect that gives users feedback about what they're interacting with.
Putting It All Together
A good dropdown shadow feels natural and supports the design's hierarchy without drawing attention to itself. It says "here's something important that's floating above the page" without screaming about it.
Use the shadow generator to experiment with different values against your actual dropdown colors and backgrounds. Start with one of the examples provided, preview it in context, and adjust from there. In a few clicks, you'll have a shadow that feels perfect for your interface.
The goal isn't to have the fanciest or darkest shadow. It's to have a shadow that helps your users understand the structure of your interface and feel confident interacting with your dropdowns and popovers.
