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

    Hi, I would like to know if this works on all IEs? cuz your example doesn’t show on mine…the supposed to be rounded box is not. thanks!

  2. gionni says:

    Thanks great script!
    To eliminate borders stroked=”False” in the roundrect.

  3. SEO Tutorial says:

    I am trying to fix the joomla layout by including this type of box. Can anybody help me

  4. There are many simple and javascript enabled complex examples to build rounded box. But the best is which are exandable freely and not of fixed with.. Regards Bikram

  5. Martijn Laarman says:

    Firefox 2.0.0.17 chokes on the image bit, it does draw the curver border i’ts not wide enough to cover the entire edge of the image.

    My I7 complains when trying to set arcSize, heres the watch on ‘this’
    this
    {…}
    defaults: Access is denied.
    document: {object}
    element: {object}

    Also without any JS stuff is a bit misleading 😉

  6. web designer says:

    yes it works very nice

  7. ismael says:

    Thanks for the script.

    Works perfect… or almost.

    For some reason, it also removes some styles within divs.

    See, for instance, the tag cloud in
    http://ictlogy.net/bibciter

    Now deactivated for IE, but, if activated, the tag cloud becomes a normal bullet list. Weird.

  8. David says:

    Hum… it seem to work on ie7… is that normal? what about google chrome? I’ll try getting some spare time to play with it.
    Looks great on firefox though!
    Good job

  9. Roman says:

    Rly all browsers? wat about firefox2? icab? konqueror?

  10. Marin says:

    @Salco I will when it’s done and cleaned 🙂

  11. Salco says:

    @ Martin
    So you’r gonna make it work well.
    Why dont you drop your version of htc here?

  12. Marin says:

    Awesome script Remiz

    @abecadlo normal for Opera it does not support htc behaviors. your IE6 must be a standalone version.

    @Paul Gonella: normal: there is a stroke. Apparently it cannot be removed.

    I’ve tweaked the htc so that the stroke has the same color as the background-color

    l.30 strokecolor=”‘ + fillColor + ‘”

    and I’ve adapted my version so that the width and height are always the same as the elements the script applies to:
    var w=this.offsetWidth,h=this.offsetHeight;
    width: ‘+(w-2)+’px; height:’+(h-2)+’px; antialias: true; in the roundrect

  13. abecadlo says:

    it doesn’t work with Opera 8.21 and IE 6 on Win XP …

  14. Paul Gonella says:

    For some reason if I have no border set in my CSS in IE7 the curved corner DIV has a black border that I can’t remove.

    Any ideas?

  15. Rick says:

    Fresh concept!

    Needs some work to avoid text in the curved part of the div (border)

    Keep up the good work

  16. Henrik says:

    There are some problems with this script when using floats, it will tamper with margins and therefor layouts will be wacked

  17. Martin says:

    Ok, iam back here i checked on Browsercam with XP SP2 and it worked Fine! 🙂 Great!

  18. Martin says:

    Great idea with that htc File! But somehow it doesnt work in Multiple IE6. Iam going to test it on a real XP SP2 IE6 install later on.

  19. Anees says:

    hmm.. Good try, this is interesting, also this can reduce a lot of codes in the page…

    Keep exploring. all d best

  1. November 23, 2008

    […] for the keyword “cross browser” for which my blog got good ranking for the post cross browser curved corner div using border radius. I tried to find who ranked before me for the keyword “cross browser”.  But […]

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