How to Create a CSS3 3D Text Plugin for jQuery
We’re going to make life a little easier with a jQuery plugin. It will do the hard work and generate long-winded CSS3 code such as:
text-shadow:
-1px 1px 0 #ddd,
-2px 2px 0 #c8c8c8,
-3px 3px 0 #ccc,
-4px 4px 0 #b8b8b8,
-4px 4px 0 #bbb,
0px 1px 1px rgba(0,0,0,.4),
0px 2px 2px rgba(0,0,0,.3),
-1px 3px 3px rgba(0,0,0,.2),
-1px 5px 5px rgba(0,0,0,.1),
-2px 8px 8px rgba(0,0,0,.1),
-2px 13px 13px rgba(0,0,0,.1)
;
Our jQuery plugin uses JavaScript to apply a CSS3 style. You’d normally avoid doing that since it’s be slower and, without JavaScript, the user won’t see the effect.
However, the 3D is unlikely to be essential and the plugin will save a significant number of development hours. If you still feel dirty, copy the generated text-shadow property from Firebug into your static CSS file.
How to Use the Plugin
jQuery and the plugin should be included on your page — ideally just before the closing
