Curing CSS3 Headaches in Older Browsers

You've seen it time and time again on Webdesigntuts+; a CSS3 tutorial which you're tempted to follow, but lack of support in older browsers stops you from looking any further. There are however, a number of tools to help out in situations like these. Today we're going to figure out how to conquer CSS3 in older browsers, including Internet Explorer..

Let's take a look at a range of techniques to render the most important CSS3 properties in older browser versions.

Setting it Up

To begin with, download and include all the necessary scripts for this tutorial. For the purpose of this exercise, place all scripts in the same folder as your CSS files. Here are the tools we'll need:

CSS3 PIE

CSS3PIE is our IE assistant. PIE stands for Progressive Internet Explorer, and it extends the behavior of Internet Explorer to help it recognize and display CSS3 properties.

Check out the CSS3PIE download folder where you'll find various files. We're going to use PIE.htc, and we'll call it from our CSS, so I suggest you put it in the same folder as our style sheet.

Selectivizr

Selectivizr is used to handle CSS3 Selectors. It's used in conjunction with a JavaScript library, such as jQuery or Mootools. I recommend opting for Mootools as it supports all the Selectivizr functions (CSS selectors).

For this tutorial, I'm going to use the Google-hosted Mootools library, so, we simply include it in our head:

jQuery

We can use jQuery to render an alternative to CSS3's text-shadow property. We simply need to download the jQuery text-shadow plugin, then, include it with jQuery:

OK, that's covered our toolkit, now let's see how we use those tools to solve our CSS3 headaches..

Border-radius is probably the most familiar of CSS3 properties. Thankfully, rendering it in Internet Explorer is simply a case of using CSS3PIE.

As you can see, we have only to "call" the PIE script, after having defined our border-radius rule.

In a similar fashion to border-radius, for Internet Explorer to recognize box-shadow we just have to include the PIE script. Note that we can also declare the shadow color using RGBA values.

You can also use RGBA colors when declaring a background-color.

To allow CSS3 PIE to render background gradients, we prepend background: in the following way:

Actually, it's very similar to the various other browser vendor rules. Remember to call the CSS3 PIE behavior afterwards!

Multiple Backgrounds

Again, in this case, we have to use the -pie- prefix:

Border Image

The last property CSS3 PIE caters for is the border-image:

CSS3 Selectors

Now it's time to get dirty with Selectivizr. Include the JavaScript library as demonstrated at the start of the tut, then all CSS3 Selectors will be recognized by IE6+!

This effect can be rendered cross-browser most easily using the jQuery library. Having included it, simply call the textShadow() function, pointing to your selector:

IE Special Filters

To replace some CSS3 properties you can also use IE filters. This first example is for background gradients:

This second one, is the equivalent to the transform property. However, the syntax is such a headache that you're advised to use a generator to calculate it.

Conclusion

As you've seen, with various tools we can ensure reasonable rendering of CSS3 in older browsers. I hope this encourages you to take the bull by the horns and practice many of the effects achievable with CSS3! Thanks for reading.