views:

193

answers:

5

I cannot make the image a background image to a div and round the div's corners because the image is resized, and as far as I know, you cannot resize a background image.

What are my options, if any? Open to all suggestions including wrapper divs and corner images.

Also, if it cannot be done in IE but there's a solution for Firefox, that's just fine with me.

+1  A: 

If you're re-using the image and it's varying in size, you should be chopping up your corners accordingly if possible. I had a quick look for you, and here's a site that shows you how to achieve it using sprites. This increases your markup because you need to use positioned divs to position each section of the box.

Of course, recent versions of Firefox, Safari, Opera and Chrome support border-radius which allows you to create rounded corners without using images. IE9 will support this too, when it gets released.
I've seen sites that use border-radius and just leave it at that, so the borders aren't rounded in browsers that don't support it.

Andy E
From what I've read, border-radius will not work for images in firefox. Looking into youre spites solution right now. thanks.
Brian
Success...thanks!
Brian
upvoted since no one else bothered to.. i dont get why selected answers aren't voted....
meder
@meder: thanks :-)
Andy E
A: 

The jQuery corner plugin is what I use. You can do:

$('#div').corner('10px');

jgubby
Thanks for the answer. Was saving javascript as a last resort, so I'll check this out if it comes to it.
Brian
A: 

I am not sure, but maybe you can achieve what you want by using svg backgrounds. This will not work in IE.

Pedro Morte Rolo
+1  A: 

If you're interested in creating corners in IE then this may be of use - http://css3pie.com/

Sniffer
A: 

Here is the good example.

http://www.templatespoint.com/blog/2010/10/expandable-rounded-corner-box/

Eswar