CSS3 Recipes for Internet Explorer 6, 7 and 8

CSS3 Recipes for Internet Explorer 6, 7 and 8

Recently as a quick fix to a headache I resorted to adding ‘behaviour’ css modifiers to my IE scripts to add CSS3 style behaviours for IE6/7/8; its a quick and easy thing to do simply refer to http://css3pie.com/ , but before you wonder off test one thing for me.

Grab the file from that site and upload it to your server, then reference it in a page (nick the source of that webpage to test, its quicker), then using a handy tool such as FIDDLER check that the .htc headers and that the CONTENT-TYPE is set to text/x-component and nothing else…

If you find that it isnt and that the page doesnt work 9 times out of 10 your mime-types on your server dont include .htc; in which case as a server admin you can simply add these… or if you dont have control of that aspect of your server (as many many many dont) simply use the following code to make it work… its really simple.

PHP .htc MimeType Fix

ie-css3.php

<?php header('Content-Type: text/x-component; charset=utf-8'); ?>
<!-- PASTE CONTENTS OF ie-css3.htc file here -->

ASPX .NET .htc MimeType Fix

ie-css3.aspx in C# obviously swap the language to VB if your using VB

<%@ Page Language="C#" ContentType="text/x-component"%>
<!-- PASTE CONTENTS OF ie-css3.htc file here -->

Classic ASP VBSCRIPT .htc MimeType Fix

<script type="text/javascript"><!--mce:0--></script>
<!-- PASTE CONTENTS OF ie-css3.htc file here -->

Python .htc MimeType Fix

self.response.headers['Content-Type'] = 'text/x-component'
<!-- DEAL WITH THE CONTENTS OF ie-css3.htc file here -->

Remember to change the ie-css3.htc references in the stylesheet to match your own file type (php/aspx etc)

Chris McKee

Chris McKee

https://chrismckee.co.uk

Software Engineer, Web Front/Backend/Architecture; all-round tech obsessed geek. I hate unnecessary optimism