Examples for Creating Cross Browser Compatible CSS Text Shadows

Safari Only

Shadowed in Safari

.shadow {
	text-shadow: #666666 5px 5px 5px;
}

Internet Explorer Only

Shadowed in IE/Win

.shadow {
	height: 1em;
	filter: Shadow(Color=#666666, 	
			Direction=135, 
			Strength=5);
}

IE/Win and Safari

Shadowed in IE/Win and Safari

Mozilla, and other beasts who know about :before

Do I know about :before?

.shadow {
  line-height: 2em;
  white-space: nowrap;
  
}

.shadow:before {
  display: block;
  margin: 0 0 -2.12em 0.15em;
  padding: 0;
  color: #666666; 
}

#shadow_header:before { content: 'In shadow'; }

Messy in Safari

Looks messy in Safari

Final Example

In shadow

/* default setup that everything sees */
.shadow {
  /* needed for Internet explorer */
  height: 1em;
  filter: Shadow(Color=#666666, 
                 Direction=135, 
                 Strength=5);

  /* Needed for Gecko */
  line-height: 2em;
  white-space: nowrap;
}

/* 
 * used by browsers which know about
 * :before to create the shadow 
 */
.shadow:before {
  display: block;
  margin: 0 0 -2.12em 0.15em;
  padding: 0;
  color: #666666; 
}

#shadow_1:before { 
  content: 'In shadow'; 
}
#second_2:before { 
  content: 'Happy Shadowing!'; 
}

/*\*/
html*.shadow {

  [color:red;/* required by Safari 
              * so that [] is correctly
              * begun. associated with
              * the property, yet hiding
              * it. Seen by IE6 */

    /* 
     * seen by IE6 and Safari, but hidden
     * from Gecko 
     */
    text-shadow: #666666 5px 5px 5px; 

  ]color:auto; /* resets color for IE6 */
}/**/

/* 
 * end hack using dummy attribute selector
 * for IE5 mac
 */
.dummyend[id]{clear: both;}

/*\*/
html*.shadow:before {

  [color:red;/* required by Safari. 
                seen by IE6 */

    /* 
     * seen by IE6 and Safari, but hidden
     * from Gecko 
     */
    display: none;

  ]color:auto; /* resets color for IE6 */
}/**/

/* 
 * end hack using dummy attribute selector
 * for IE5 mac
 */
.dummyend[id]{clear: both;}

How it looks in various browsers

Shadowed text in various browsers