Curved corner (border-radius) cross browser

Update 18 November , 2009: The htc file is updated by Nick F. Thanks man, you got time to check it out. Now supports FF, Chrome, Safari, IE6, IE7, IE8 (Os doesn’t matter).
This version of htc files can be found here and demo here


Update 17 August, 2009: This project is moved to Google Code. Please find the htc files on http://code.google.com/p/curved-corner. Links to htc file below will not work.


Update 16 July, 2009: htc file updated with support for IE8. Thanks to Kevin for coming up with a work-around. New htc file can be downloaded on border radius ie8.


Update 10 June, 2009: Some servers need to set MIME type for HTC to work this in IE6.
To do this, follow the steps.

1. Go to your cpanel and click the MIME Types link
2. Under MIME Type, add text/x-component
3. Under Extensions, add htc
4. Restart Apache Web server


As I’ve pledged, today I’m posting the Curved corner without any js stuff.

For firefox, you can set border-radius by prefixing “-moz” to the css property. And ofcource for webkit use “-webkit” . Now IE ?? .. As IE is not a good browser to work with css, we need to make it so. Here, you need to use a nice css hack. Some how I managed to have an htc file to make border-radius work in IE  🙂 . You can download it here. border-radius.htc .

The Demo

1 . I’ve just made: http://www.htmlremix.com/files/20080924-border-radius.zip

The CSS:

  1. .curved {
  2. -moz-border-radius:10px;
  3. -webkit-border-radius:10px;
  4. behavior:url(border-radius.htc);
  5. }

The HTML:

<div class="curved">Curvd div</div>

The explanation :

Do you really want an explanation for this simple 3 line css ?. I don’t think so. Ofcourse if you need, I can.

Browsers :

All browsers 🙂

Download


Many people failed to find a download link. So no one will miss it again now 🙂

Remiz

Remixed version of unstable human emotions and thirst of mankind actions. UX designer, UI developer and HE of WebCastle Media Pvt LTD

You may also like...

750 Responses

  1. amac44 says:

    spiffy corners is the best I’ve seen, no images, no JS, http://www.spiffycorners.com. But it’s a rounded box set into a rectangle, and you can’t control the radius (only the 5px button works). The idea could be extended I’m sure.

  2. mxworkz says:

    Unfortunately the problem with Opera still exists 🙁 In order to make it really cross-browser, we need to use SVG for defining the rounded areas about Opera. With this addition, it will be already a cross-browser solution.

  3. xyz says:

    In my site on header code this is work fine..but in my inner code this not work

  4. Elguapaul says:

    Excellent !! Thanks so much.

  5. yo says:

    Otherwise, to have corners rounded independently, you can use http://www.dillerdesign.com/experiment/DD_roundies/ but this is implemented using Javascript, not VML.

  6. Hippy says:

    This does not seem to work for me… what could I be doing wrong?
    I have IE 8 and my code for all the other browsers is working, but not IE.

    Thanks

  7. Lidocain says:

    @ iMezied :

    You can’t specify which corner to curve. This HTC for border-radius can only round the 4 corners at once with the same radius.
    It’s a limitation of Microsoft’s VML (used to make these rounded corners in IE 5-8). It’s “all rounded the same” or “none rounded” 😉

  8. Sanat says:

    You’re a lifesaver 🙂 Keep up the good work

  9. iMezied says:

    how i can specific which corner i need to curve
    eg. right top corner or left top corner only can be curved ?
    thanks 🙂

  10. Tali says:

    hi,
    I downloaded your htc file. I added the 3 simple lines .
    I work on: .NET I test my site on FF and IE7 and IE8 .
    1. behavior – my css does not know this .
    2. it is not working in IE, do I need to add hte Mime type?

  11. Great HTC script, but it doesn’t work when you hover A element(a:hover) any workaround?

  12. Charlotte says:

    Hi,
    Thanks very much. Works brilliantly except I can’t make it work with Spry collapsible panels in IE (fine in Firefox). Any suggestions gratefully received.
    Thanks

  13. Aleksey says:

    Please take the right link, there you can download all the files:
    http://code.google.com/p/curved-corner/

  14. shimaa says:

    dears i try and try to work by .htc file but work good all browsers except IE8 make hide all content in the div have class curved
    plz help me

  15. Laxmi says:

    Not working in IE8

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

    Calling

  16. Luke Freiler says:

    I just tried this in IE8 (win7 x64) and came up with an activex dialog that required me to accept script access in order to get the rounding.

    Is this default behavior in IE8? Does it happen in the other IEs?

  17. Helen says:

    For many years (approx 2 hours) I’ve been looking through complex codes.
    and all it took was THIS?!!!!!!!!!!!!!!!!!!!

    THANKYOU so much. Ymmd.

  18. Carla says:

    Is there any way to get background-repeat and background-position to work within a rounded rectangle? I can see fill.type=’tile’ is set in the htc code which is part of the problem. However it seems that there is no option under type (http://msdn.microsoft.com/en-us/library/bb229619%28VS.85%29.aspx) that allows for a single image anchored as a background within the element, even when using Origin and AlignShape attributes. Any thoughts on how to make this work? (I don’t want to stretch the image either so I can’t use ‘frame’)

  19. Zoltan says:

    Hy!
    I was tried the .htc but in IE I loose the background and border parameters not displayed the background image and borderline
    what’s wrong?

Talk your view

Read previous post:
Template fixed !

Finally , I got a nice simple template for this blog.  Hopefully,  I'll be posting from tommorow :) . I...

Close