Jessica Hammer - March 11, 2008
Part 2 – A few tips on improving your relationship with ie and its bugs
In part 1 of this series IE 6 Reluctant friend and frequent foe – Part I, I did rant just a bit about the myriad of downsides to Internet Explorer 6 and how much this frustrates me on a daily basis. I am often tempted to pin the logo to a dartboard and let rip! However, from the hours of trouble shooting, re-coding and incoherent, angered mumbling, a few small gems of knowledge have emerged, that help me cope.
Since it looks like we will have to live with ie6 for a while, let’s cozy up and make friends. Here are some things that make ie6 happy.
- Fix ie Stylesheet
For larger sites and many bugs, using an ie6 specific stylesheet helps you troubleshoot for ie6 alone.
All you need to do is add the following code underneath the link to your regular stylesheet
The code in fix-ie.css will only appear in ie6 (or as the code says; less than ie7) and over-ride any identical code in the regular stylesheet.
- The miraculous double-margin manifestation
It is a well observed phenomenon that if you have a floating div with a margin, ie will take that margin and double it! Now that’s generosity! But if you meant what you coded, then all you need to do is add
{ display:inline; }
to the floated div and you are back on track.
- More Padding and Margin drama
While I haven’t got a full list of all the phantom margin additions in ie, I do know that it doles them out quite liberally. My advice: if you are having any margin, padding, or placement issues, set all paddings and margins explicitly. Do not leave any of it up to the browser’s defaults. If you want padding only, then set {margin:0;}
just to be sure!
I have observed that ie6 adds a lot of default padding to elements like
tags, so be sure to state all padding and margins on these elements.
Hopefully this may help clear the ie fog, or at least assist you in extending an olive branch to ie6. If not, then all we can do is wait and cross-check. In my next post, I will share all our MoreVis browser cross-check and testing secrets. Hint: it involves a lot of desk hopping!!