Effect How to - Create CSS3 Box Shadow








Question

We would like to know how to create CSS3 Box Shadow.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.shadowOne {<!--from   ww  w. j a va2s.  c  o m-->
    background-color:#c06;
    padding:5px;
    color:#fff;
    -webkit-box-shadow: 5px 5px 5px #000;
    -moz-box-shadow: 5px 5px 5px #000;
}
.shadowTwo {
    background-color:#c06;
    padding:5px;
    color:#fff;
    -webkit-box-shadow: -5px -5px 5px #000;
    -moz-box-shadow: -5px -5px 5px #000;
}
  </style>
</head>
<body>
  <p class="shadowOne">This is a box with a shadow</p>
  <p class="shadowTwo">This is a box with a shadow</p>
</body>
</html>

The code above is rendered as follows: