Filters: shadow()

CSS:
style="filter:shadow(color=black, direction=135, strength=10)"
DOM:
object.style.filter="shadow(color=black, direction=135, strength=10)"


Macaws
color:
direction: °
strength: px


Figure 11-39. Application of shadow() filter.

The shadow() filter creates an offset shadow for depth. The general formats for the shadow() filter are shown below.

CSS:
filter:shadow(color=color, direction=n, strength=n)

DOM:
object.style.filter="shadow(color=color, direction=n, strength=n)"
Figure 11-40. General formats for shadow() filter.

For a shadow effect, the elements must appear inside a container element to which the effect is applied. The container must be as large or larger than the dimensions of the elements with their shadows applied. The following code shows a typical way to apply a shadow to elements inside a division.

<div id="DIV" style="padding:20px; 
filter:shadow(color=black, direction=135, strength=10)">
  <img src="Macaws.jpg"/><br/>
  <span style="font-family:verdana; font-weight:bold; font-size:14pt; 
    color:red">Macaws</span>
</div>
Listing 11-17. Code to apply a shadow to the contents of a division.