CSS shadow effect

I know, we said we’ll focus on WordPress tutorials but, I can’t resist sharing cool CSS tricks from time to time like this one CSS shadow effect we’ve used for our Vela theme. If you take a look at Vela header you’ll see h1 and h2 text with blog title and description. Vela comes with two different background images, one is very colorful and the other one is dark, so to keep text readable in this situation you have to use shadow or text border. And since there’s no enough support for text-shadow CSS3 property (only for Safari so far) you have to improvise.

shadow

What we’re going to use is pure CSS solution, but you can use for example some JavaScript with a simple loop or something… Here’s the code and after that an explanation.

<h1><span><a href="#">Some text</a></span>Some text</h1>
h1 {
        font-size:26px;
        font-weight:bold;
        color:#111;
}

h1 span{
        position:absolute;
        margin:-1px 0 0 -1px;
        color:#fff;
}

Yes, that’s all! Key element is span tag with same text which is positioned absolute and moved a bit. You can place it in any tag you want and also add links and everything like in example. This is tested on FF, IE6, IE7, IE8, Opera, Chrome and Safari.

Posted by: ThemeGalaxy on February 26, 2009
WordPress 3.0.1

Our cutting-edge premium WordPress themes are compatible with the latest WordPress version release, and also work well with previous versions.

XHTML & CSS

Our commercial WordPress themes are coded using semantic and up-to-date xhtml and css. This means that our themes are nimble, and display consistently in all major browsers.

AJAX & JavaScript

Some of our website templates make use of AJAX for some nifty animation effects all of which enhance the user experience. We never use Flash for these purposes. Ever.