1

I need to add a shadow to a DIV with using CSS3. For adding a shadow for the bottom part of the DIV, I use:

-webkit-box-shadow: 0 1px 10px rgba(0, 0, 0, 0.75);
        box-shadow: 0 1px 10px rgba(0, 0, 0, 0.75);

But how to add yet also the same shadow for the top?

Thank you

Salman A
  • 262,204
  • 82
  • 430
  • 521
user984621
  • 46,344
  • 73
  • 224
  • 412
  • search would have helped you: [CSS Box Shadow - Top and Bottom Only \[duplicate\]][1] [1]: http://stackoverflow.com/questions/6671375/css-box-shadow-top-and-bottom-only – andreasbecker.de Mar 17 '14 at 15:13

3 Answers3

2

You have 2 posibilities:

1) play with the spread property, in negative, to compensate for the blur and avoid the shadow to show in the sides:

.one {
    box-shadow: 0px 6px 8px -3px rgba(0, 0, 0, 0.75), 0px -6px 8px -3px rgba(0, 0, 0, 0.75);
}

2) clip the result so that again the borders don't show. You will need position: absolute for this one to work:

.two {
    box-shadow: 0px 6px 8px rgba(0, 0, 0, 0.75), 0px -6px 8px rgba(0, 0, 0, 0.75);
    clip: rect(-12px, 100px, 62px, 0px);
position: absolute;
}

fiddle

vals
  • 61,425
  • 11
  • 89
  • 138
1

You can apply multiple box-shadow by separating your arguments with a comma:

box-shadow: 0 1px 10px rgba(0, 0, 0, 0.75), 0 -1px 10px rgba(0,0,0,0.75);
Dre
  • 2,933
  • 2
  • 18
  • 21
0

Something like this is exactly what you need;

.box {
    box-shadow: 0  8px 8px -8px rgba(0,0,0,.75), 
                0 -8px 8px -8px rgba(0,0,0,.75);
}

Here is a jsfiddle

Chuks
  • 1,134
  • 11
  • 21