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:
- .curved {
- -moz-border-radius:10px;
- -webkit-border-radius:10px;
- behavior:url(border-radius.htc);
- }
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 🙂
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.
@Remiz
sure I will send you my modified file but I haven’t found an option to contact you via mail.
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..
@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 ?
Very nice site!
Wow, it works perfectly fine by me ! 🙂
Thanks a lot !
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 !
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?
Hi Remiz
How to use this .htc for only topleft and topright corner, as I want to use it for Tab Menu
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.
well done boy thnks
Very Very Good
Thank You
Well done, Remiz
What license do you grant for this script?
Is it free to use or do you plan any restrictions later?
DirkO
It is in CC licence already. Hosted on Google Codes.
http://www.htmlremix.com/css/css-curved-corner-on-google-code
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).
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.
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
does it compatable with IE8
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.