Monday 26 December 2011

CSS3 Box Shadow

CSS3 Box Shadow
 In CSS3, the box-shadow property is used to apply shadow to boxes or depth of the elements.

Syntax:

 ·  -webkit-box-shadow: 1px 1px 3px #292929;
 ·  -moz-box-shadow: 1px 1px 3px #292929;
 ·  box-shadow: 1px 1px 3px #292929;
 Box-shadow accepts four parameters:

x-offset -1px
y-offset - 1px
blur - 3px
color of shadow - #292929
 div
 {
 box-shadow: 10px 10px 5px #888888;
 }

Example:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <title> box-shadow </title>
 <style type="text/css">
 #box
 {
 width:300px;
 height:100px;
 background-color: #663333;
 -moz-box-shadow: 10px 10px 5px #888888; /* Firefox 3.6 and earlier */
 box-shadow: 10px 10px 5px #888888;
 }
 </style>
 </head>
 <body>
 <div id="box">
 </div>
 </body>
 </html>

Result:

No comments:

Post a Comment