views:

339

answers:

3

alt text

I'd like to apply rounded corners to several blocks using the single image (above). I know there're corners plugins available but I need to use images for max compatibility. So, as I know, the only way is to create wrappers around the blocks to apply the corner images:

<div class="wrapper-4"> <!-- top-left corner -->
  <div class="wrapper-3"> <!-- top-right corner -->
    <div class="wrapper-2"> <!-- bottom-left corner -->
       <div class="wrapper-1"> <!-- bottom-right corner -->
          <div class="content"> <!-- Content Block -->
            I feel squeezed!
          </div>
       </div>
    </div> 
  </div>
</div>

Ugly I know, but its the only way I guess, using jQuery to create the wrappers will make it less ugly I guess. So what I need help with is to understand how exactly will the CSS will be created around these DIVs and image (above) using the sliding doors method so the corners would show up well, especially in IE. I've created buttons using the sliding doors method, but never tried this.

Appreciate any help. Thanks!

+1  A: 

There's a JQuery Plugin for that that may help: http://plugins.jquery.com/project/corners However, I'm not sure whether that will work for the gradient to the bottom of the element.

Pekka
I specifically said I didn't want to use the corners plugin, because Canvas is not supported in IE8. Does this work in IE8?
Nimbuz
Sorry, I overread that. I don't know whether it works in IE8 but I would very much expect so - there is nothing saying the contrary in the release notes.
Pekka
Great, it does work in IE8! Thanks! :)
Nimbuz
+3  A: 

To continue using the way you know you could try something like:

$(div.content).each(function() {    
    $(this).wrap('<div class="wrapper-4"><div class="wrapper-3"><div class="wrapper-2"><div class="wrapper-1"></div></div></div></div>');
});
Justin Wignall
A: 

I need to use images for max compatibility

Great, it does work in IE8!

lol...

DanyAlejandro