20

Is it possible to display a shadow inside a div box without using pictures? Instead I want to use css commands.

So is there some command like: -webkit-box-shadow: 1px inset; ?

Mel
  • 5,837
  • 10
  • 37
  • 42
Tim Daubenschütz
  • 2,053
  • 6
  • 23
  • 39
  • They actually use image in the tumblr website, two images to be precise. One shadow image for full page width and second broader shadow image in the center of the page. – Joonas Mar 12 '12 at 10:51

3 Answers3

39

Yup there is a command inset. like this:

-webkit-box-shadow: 0 0 1px 3px #000 inset;
-moz-box-shadow: 0 0 1px 3px #000 inset;
box-shadow: 0 0 1px 3px #000 inset;

You can generate from here http://css3generator.com/

sandeep
  • 91,313
  • 23
  • 137
  • 155
21

In CSS3 there's box-shadow which can also be inset to do exactly what you need. This is supported by the following browsers:

  • Chrome >= 10.0 (>= 4.0 with -webkit prefix)
  • Firefox >= 4.0 (>= 3.5 with -moz prefix)
  • IE >= 9.0
  • Opera >= 10.5
  • Safari >= 5.1 (>= 5.0 with -webkit prefix)
Jam Roll
  • 13
  • 3
oezi
  • 51,017
  • 10
  • 98
  • 115
0

You can use Box shadow generator for shadow effects. I will give an example to show how to use the box shadow generator.

Step 1: Go to : Box Shadow Generator

Step 2: adjust the shadow property you want to add.

Step 3: Then copy the css code using "copy text" button.

step 4: Then you can past the css code into the style sheet file.

Do like this.

<html>
<head>
    <title>Title</title>
    <style type="text/css">
    #banner{

        position: absolute;
        width: 100%;
        height: 150px;
        background-color: #4E6C88;
        -webkit-box-shadow: -1px 9px 18px 0px rgba(0,0,0,0.75);
        -moz-box-shadow: -1px 9px 18px 0px rgba(0,0,0,0.75);
        box-shadow: -1px 9px 18px 0px rgba(0,0,0,0.75);
    }

    </style>
</head>
<body>
 <div id="banner">    

 </div>
</body>
</html>

Thank you... ;)

Arunraj S
  • 758
  • 7
  • 26