html text shadow effect code example

Example 1: image shadow css

<!Doctype>
<html>
<head>
  <style>
    .img {
      width: 400px;
      height: 200px;
      border:2px solid #fff;
      background: url(img/tiger.png) no-repeat;
      box-shadow: 10px 10px 5px #ccc;
      -moz-box-shadow: 10px 10px 5px #ccc;
      -webkit-box-shadow: 10px 10px 5px #ccc;
      -khtml-box-shadow: 10px 10px 5px #ccc;
    }
  </style>
</head>
<body>
  <div class="img"></div>
</body>
</html>

Example 2: text shadow effect

//offset 2px right and down with a 5px defusion of gray
h1 {
  text-shadow: 2px 2px 5px gray;
}

Example 3: text shadow css

.myClass{
  /*           x   y   blur color */
  text-shadow: 1px 1px 0px #ff0000;
}

Example 4: css add a shadow beneath text

.red-text-shadow {
  text-shadow: red 0 5px;
}

Tags:

Misc Example