Fixing IE6 with VML

Posted by Sean on Dec 09, 2008 under

Recently, HTMLRemix and Drew Diller has released 2 scripts that have really helped fix some of IE6's crappy support: CSS Rounded Corners and Alpha Transparency PNGs.

CSS Rounded Corners

In all browsers besides Internet Explorer, we can use CSS properties to apply rounded corners to the box model. And to get the same look in IE, you usually would need to slice several images. Thanks Microsoft's non-standard VML, you can now get rounded corners without any slicing. I enjoy HTMLRemix's version, but also just learned of Drew Dillers:

HTMLRemix

This fix involves an IE behavior, simply allowing something like this:

.curved {
	-moz-border-radius:10px;
	-webkit-border-radius:10px;
	behavior: url(border-radius.htc);
}
DD_roundies

Drew attaches a behavior through Javascript instead of CSS specifically (it's a dynamically added style). Just give the function arguments of a CSS selector (the example uses a CSS class), and the radius in pixels.

DD_roundies.addRule('.box', 10);



Alpha PNGs

Another thanks Drew for this one. Works much the same way as his roundies script does. Actually, his roundies script revealed that VML can draw transparent imagery without AlphaImageLoader, and so he quickly turned it into something to fix all PNGs. Brownie points for allowing background-position and background-repeat properties to still work with this fix.

It's equally simple to turn on; simply provide a CSS selector to the function:

DD_belatedPNG.fix('.png_bg');



Since this adds the style directly to the DOM, only selectors that IE6 understands will work. It'd be great to be able to add versatile style like [href$='.png']. Maybe I'll throw that in there someday.

Add a Comment

Search

Categories

Treats

  • No RSS feed found.
See all »