Creating an inset dark drop shadow effect with CSS

endy picture endy · Jun 14, 2011 · Viewed 9.7k times · Source

I'm trying to get an effect like an inset drop shadow effect in CSS that looks like the following image:

image of sunken button
(source: gyazo.com)

Does any body know how I can get that effect with CSS?

Answer

theozero picture theozero · Aug 5, 2011

The key here is multiple box shadows, a larger darker one inset from the top left and a very subtle shadow below thats slightly brighter than the background.

Notice the form of box-shadow is "x-offset, y-offset, blur, color"

Learn to use the blur amounts and multiple shadows and you can make some really nice effects.

Example style (for display on a background of #222):

.button {
    display:inline-block;
    padding: 10px 15px;
    color: white;
    border-radius: 20px;
    box-shadow: inset 2px 3px 5px #000000, 0px 1px 1px #333;
}