HTML Remix - Dont copy code, remix it!

December 6, 2009

CSS level 3 styles in Internet Explorer 6 onwards

Posted by : Remiz
Filed under : CSS

As web developers, we all hate Internet explorer to an extant. But in my earlier post, I wrote why not to hate Microsoft and IE. It is the people who use out dated software (IE6 is almost ten years old) and try to run our CSS3 level high Ajax’s web 2.0 designs.

border-radius

Last year, I published an htc file, which makes Internet explorer 6 to have rounded corner DIVs. For other modern browsers, we can have border-radius CSS property. For mozilla, you need to prefix -moz- and for webkit based browsers (Safar, Chrome) prefix -webkit- . SO the CSS for a DIV with rounded edges will have following styles.
.curved { -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; }

As IE wont support these CSS properties, you will have to add one more line of css and an HTC file. Here is more explanation how to make rounded corner divs in IE.

Good news : Microsoft’s Internet Explorer 9 is expected to support border-radius property.

Early this month, Nick Fetchak of fetchak.com sent me a new htc file with support for IE5 to IE8 which is amazing and working well. You can find the latest version that file here.

box-shadow

Box shadow is another simply amazing CSS3 property, which is unimaginable to work in IE. It works on Safari 3+ and Firefox 3.1 onwards and Google Chrome. I am not aware of Opera this time. So what you think about making this work on IE6 ? No kidding..

CSS for box-shadow is:
box-shadow: 10px 10px 5px #888; padding: 5px 5px 5px 15px;

For older version of Firefox, you might have to add -moz- and for Safari and Chrome, try -webkit- as prefix. (My Chrome is already supporting without any prefix).

So, here what you need for IE to make box-shadow.

behavior: url(box-shadow.htc);

Download the htc file here or Demo here. The project is hosted on Google code.

  • Comments (8)

8 Responses to “CSS level 3 styles in Internet Explorer 6 onwards”

  1. [...] Download the htc file here or Demo here. The project is hosted on Google code. via htmlremix.com [...]

  2. Ben,

    I had the same problem and managed to hack/fix it by moving the CSS styles that applied the border-radius.htc file to the bottom of my page i.e. insert a block just before the tag.

  3. Peter says:

    Will the htc script work for border radius top right and others or just border-radius;

  4. gaurish says:

    hi…
    not working in google chrome…

  5. deadman says:

    Very impressive, although (as others may have pointed out) it doesn’t handle cases where different corners have different rounding. It always gives all corners the same setting.

    I look forward to future versions.

  6. Dragon says:

    Thanks for this script. When I move both the external .css file (containing the reference to the .htc file) and the .htc file together out of the directory the .htm file is in, the .htc files does not work. Must the .htc file be in the same directory as the .htm file? Thanks again.

  7. Ben Chapman says:

    Hi. Thanks for your work on this. I have, however, found an issue that is more pronounced in IE7 but also affects IE8 if the container being styled with round edges contains a significant amount of code, in my case, a complex nested CSS dropdown menu. The border radius HTC tries to fire before the browser has finished rendering the menu code causing the error:
    Message: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)
    Is there some way to delay the HTC effect on complex elements until the rest of the page is fully loaded?
    Regards
    Ben

  8. Evan Byrne says:

    This is great man, thanks for sharing!

Leave a Reply

Subscribe via email

WebCastle
SEO Book

Google Ads