Which allows me to use a single image file (less handshakes so less load time issues), NOT put images in the markup (so CSS off the page isn’t a disaster), etc, etc, etc…
Remember, separation of presentation from content – those images are presentation, and as such don’t belong in IMG tags – EVER.
Oh, and don’t forget to use a doctype so IE isn’t in quirks mode, STOP typing in tags in uppercase like it’s 1997, etc, etc…
That’s ok but uses one too many elements and too many classes for my liking :). It doesn’t work in IE6 either (at least the author doesn’t know the right way to make it work in IE6) and you can’t use absolutely placed corners in IE6 anyway as they will be 1px out on odd pixel widths. If you are not supporting IE6 then I’d probably drop support for 7 and 8 also and then use border radius.
Or if you just want IE8+ support you can use the :before and :after pseudo elements to place two of the corners with the original element holding the third corner which means only one extra element is needed for the fourth corner.
Round corners have always been a pain because of the extra elements needed. Using sptites is the best approach but if you want shadows and transparent corners then it soon gets complicated as Eric mentioned. I have an old demo here that uses two sprite images for shadows and transparent corners but is very heavy on mark up.
In the end it all boils down to finding hooks to hang your background images on. You can find a round-up of techniques here but Deathshadow’s and Erics methods are better than most you will find.
Gotta say I prefer Frank’s method.
Eric’s method is really easy but it goes only on fixed widths. I had some problems changing the “Eight Corners” according to my images, playing around with those pixels & getting it to work in Firefox. Thanks to Paul for the link to the round up of techniques.