Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Taper/fade CSS box shadow?

Tags:

css

I've got a CSS drop down menu that I'm trying to build, and the background of the drop down has a faded/tapered box shadow:

enter image description here

I'm having trouble pulling off how to get the box shadow to actually taper/fade off.

Here's where I'm at right now: http://jsfiddle.net/Shpigford/f9aKR/

I've tried using :before and :after pseudo selectors, among other things, but can't quite get it right.

For clarification, I'm specifically only needing help with the shadow on the drop down. My jsFiddle is a stripped down version to keep the example as straightforward as possible.

like image 979
Shpigford Avatar asked Jun 07 '12 19:06

Shpigford


1 Answers

  1. I've added a before element.
  2. gave it a gradient background (from transparent to a semi transparent black) to achieve the top to bottom fade.
  3. gave it an inset box shadow to achieve the in -> outfade.

Take a look -> http://jsfiddle.net/f9aKR/22/

Edit the amount of fade/colors as you want.

like image 84
João Paulo Macedo Avatar answered Sep 24 '22 08:09

João Paulo Macedo