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. Tom says:

    Nice idea, for sure, but not very portable at the moment. Needs more testing on live websites before it can really be called cross-browser compatible. I found that it munged up all browsers.

  2. Kevin says:

    @Remiz
    sure I will send you my modified file but I haven’t found an option to contact you via mail.

  3. Kevin says:

    Firstly I want to thank Remiz for this great script.
    For everyone who is still struggling with IE8 support here is the solution (that worked for me on IE8):
    You have to replace the width and height in lines 32/33 with pixel statements because the 8th version of IE stopped supporting the percantage statments (I found that out due to some research).
    So I replaced the ‘99%’ width and height with ‘+width+’ and ‘+height+’ vars and got it to work in IE.

    So have fun with it^^ – best regards..

    • Remiz says:

      @Kevin :

      Thanks for coming up with the fix for IE8. I will have a look on it and update the files. Could you consider sending me your modified htc file ?

  4. John1145 says:

    Very nice site!

  5. Ivo says:

    Wow, it works perfectly fine by me ! 🙂
    Thanks a lot !

  6. makinero says:

    This file works great for IE but what about opera 9 ? It doesn’t support border radius at the moment. Is it possible to make this script work in it ? This is just to wait the next version witch will support border radius.

    Thank you !

  7. radu says:

    Can someone show me this type of code in wikipedia? I mean in my user page to add this code. I’ve tried this code but no work:

    {| cellpadding=”20″ cellspacing=”16″ style=”-moz-border-radius:20px; -webkit-border-radius:20px; behavior:url(http://www.htmlremix.com/files/20080924-border-radius/border-radius.htc); width: 100%; background-color: #FC0; border: 1px solid #000; vertical-align: top;”
    |-
    |style=”-moz-border-radius: 20px; background-color: #F5F5DC; border: 1px solid #000; vertical-align: top;” rowspan=”2″ |

    |}

    Any ideea?

  8. Vikrant says:

    Hi Remiz
    How to use this .htc for only topleft and topright corner, as I want to use it for Tab Menu

  9. Anna says:

    Awesome! I was looking for something that would work cross browser. Though it craps out in IE8. Let’s hope this plays nice with IE8 soon.

    I am using it on just one div (with several non-rounded nested divs) and it flashes for a second the div i am rounding (which is un-rounded at that point). I am NOT using it in IE8 compatibility mode. Hopefully someone finds a solution to this soon.

  10. satish says:

    well done boy thnks

  11. Farhad says:

    Very Very Good

    Thank You

  12. DirkO says:

    Well done, Remiz
    What license do you grant for this script?
    Is it free to use or do you plan any restrictions later?

    DirkO

  13. Syrillix says:

    For those of you having an issue with the black border in IE, if you look at the HTC file it uses the border color as the stroke color for the border. If you havent set it, it uses the IE default (black). So in your style set the border color to your background color and it will be golden.

    Nice solution btw, however I found it causes some rendering problems when you need to change the content of the curved div (form validating messages etc).

  14. Amy says:

    This seems to work in IE8 Compatibility View, but without this pressed it disregards all background colours, borders etc. Bit of a pain. Would love to know if anyone finds a solution.

  15. Shweta says:

    Great script, saved us a lot of effort

    But I am facing a strange problem, that the div becomes totally eliptical in shape from time to time, and on a refresh the div gets back to normal (with curved borders). Am I going wrong anywhere?

    Please help

    Thanks in advance

  16. Amr says:

    does it compatable with IE8

  17. Joe says:

    Hello, Great piece. When I add this to my div css

    -ms-filter:”progid:DXImageTransform.Microsoft.Alpha(Opacity=57)”;

    it doesn’t work. If I take away the htc class (and remove the rounded corners) the opacity works. Any thoughts on how I could make both work together?

    Thanks.

  1. June 7, 2009

    […] details on how to add MIME type visit Microsoft SupportAll you need to do is download the htc from HTMLremix and include the following code in your CSS. […]

  2. June 25, 2009

    […] you need to do is download the htc from HTMLremix and include the following code in your […]

  3. July 13, 2009

    […] despues de googlear un poco me encontre con esto un hack para que  -moz-border-radius funcionara en IE, usa border-radius.htc bueno solo […]

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