HTML Remix - Dont copy code, remix it!

September 24, 2008

Curved corner (border-radius) cross browser

Posted by : Remiz
Filed under : CSS

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 :)

  • Delicious 0
  • Comments (410)

410 Responses to “Curved corner (border-radius) cross browser”

  1. Furqan says:

    Thanks,
    amazing dud.

  2. Greg says:

    Seems to not work if in a container with a background-color.

  3. Serkan says:

    Hi,

    I’ve a with position:fixed and inside it there are anchors with a background-color, and after applying your htc file, the background-color of the anchors disappear and become transparent.

    And it seems that it’s not working when you have a
    ul li a

    is that correct ?

  4. Ben says:

    I cannot get this to work. Here is what I have done.
    1. Downloaded border-radius.htc to the css folder
    2. In my css file I added this to the div that I want to have rounded corners.
    -moz-border-radius:10px;
    -webkit-border-radius:10px;
    behavior:url(‘css/border-radius.htc’);

  5. adnan says:

    so we cant give border on desire side in ie?

    i m trying to give but it works on all side in ie while working well in firefox

  6. Stefano Guglielmi says:

    this script s***! doesn t work on IE

    • dan says:

      try setting the url of the border-radius.htc relative from the html document, not the css file that sets the behaviour parameter.

      I have my css and border-radius.htc in folder called css, the html documents are in root. But in ie.css (which contains the behaviour parameter, and is in folder css) I put: behavior:url(‘css/border-radius.htc’).

      Works for me. But there are lots of problems if you have dynamic content that changes the size of elements without a page refresh.

  7. Hamid says:

    There is a problem when im trying to put a container div with a background!

  8. Nakul says:

    Its work in mozilla but not work in ie6,7,8 plz help

  9. adnan says:

    hi guys

    i am giving curve on left side and left side bottom. its work in firefox but it is not working in ie

    can you guys help me how it can work?

    thanks

  10. Simon George says:

    Thanks, this works great on my site.

  11. Getting border-radius to work in IE | jc-designs.net
  12. Marcelo Torres - Web Designer Freelancer e WordPress Theme Developer
  13. CSS3 Solutions for Internet Explorer | Code Base

Leave a Reply