Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

FattyMembrane

macrumors 6502a
Original poster
Apr 14, 2002
966
154
bat country
i spent 3 hours yesterday trying to get the website for a club of which i'm a member to work properly in IE. The site rendered fine in mozilla/khtml but of course IE has serious css bugs and the page looked like crap. i ended up having to create a separate stylesheet for IE and after pilfering some code from various resources on the net, i came up with a little javascript that you can put in the <head> of your file that will give IE a special stylesheet. this is nothing groundbreaking, but i thought it might be helpful to those of you struggling to keep your site IE compliant.

Code:
<script type="text/javascript">
var ua = navigator.userAgent.toLowerCase();
this.isIE = (ua.indexOf('msie') != -1);

if (this.isIE)
{document.write("<link rel='stylesheet' type='text/css' href='iestylesheet.css' />");}
else
{document.write("<link rel='stylesheet' type='text/css' href='stylesheet.css' />");}
</script>
 
I have to load a javascript file to make Internet Explorer allow alpha transparency with PNG-24 images. Instead of having javascript to check if it is IE, you can use something with this style...
Code:
<!--[if gte IE 5.5000]>
<script type="text/javascript" src="http://www.yoursite.com/link-to-javascript"></script>
<![endif]-->

This works really well because it will just be read as a comment by any browser except IE 5.5+. You could also do something similar with CSS.
 
mnkeybsness said:
I have to load a javascript file to make Internet Explorer allow alpha transparency with PNG-24 images. Instead of having javascript to check if it is IE, you can use something with this style...
Code:
<!--[if gte IE 5.5000]>
<script type="text/javascript" src="http://www.yoursite.com/link-to-javascript"></script>
<![endif]-->

This works really well because it will just be read as a comment by any browser except IE 5.5+. You could also do something similar with CSS.

wow!! that's cool!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.