Search code examples
htmlcssdropshadow

Creating an inset dark drop shadow effect with CSS


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?


Solution

  • The answer has already been given to you (box-shadow: inset ..), so here's a quick demonstration of how it could work:

    http://jsfiddle.net/L6nJj/

    The important part is box-shadow: inset 2px 2px 3px 0 red.

    For an explanation of the available options: https://developer.mozilla.org/en/css/box-shadow#Values

    Be sure to take into account the browser support for box-shadow, which is that it doesn't work in older versions of IE, but works "everywhere" else: http://caniuse.com/css-boxshadow