Someone pointed out that Way Cool Web Design likes drawing attention to the fact that that they can and do code for the lumbering MacIE5.2.3, yet last month's Web Techniques column didn’t discuss anything about the Mac. Can you guess where this month’s column is going?
It wasn't all that many moons ago that I was in love with Internet Explorer for the Mac. During that same time, I developed a loathing for Netscape. How I came to be almost diametrically opposed in my feelings about these browsers is a boring story but I hope you make the same journey if you haven’t already.
Although Netscape is dead, its ghost lives on in very good form. Other Mozilla based browsers carry the torch now, and by golly they’re more like Klieg lights now, not torches. Mozilla FireFox is an absolute joy. Well, absolute if browsers make you happy, I suppose.
Internet Explorer for Mac is a weird little hobgoblin. I used to cherish it so. I guess now that maybe it had something to do with the feeling it gave me a little bit of acceptance “in the real world,” where PC users frolick and play with nary a concern for compatibility issues.
So anyway, thanks, Microsoft, for the good times. I do appreciate the attempt at putting a good browser on the Mac. I used it faithfully for a couple years.
It wasn’t until I really started getting into CSS that I discovered MacIE for what it is a strange conglomeration of standards compliance in some cases and disregard for standards in other places. It actually does a pretty good job with CSS but darn if it doesn’t just explode in the cases where it doesn’t support some code.
Essentially, I code for FireFox, then hack for PCIE, then tweak that for MacIE. More often than not, whatever hacks I’ve added for PCIE need to be filtered out for MacIE. After that, occasionally, there’s just a few MacIE leftovers that really need special attention. That brings us to the Site Map for this web site, which we discussed last month.
If you recall from last month I rambled on about using the “* html” hack to make a CSS declaration apply itself to flavours of IE only. That’s not entirely correct but for my purposes it works. If you want to know exactly which hacks work exactly where, you’ll have to consult one of the CSS hack charts available on the net.
Any-hoo, MacIE 5.2.3, like I said earlier, actually applies CSS pretty well. The problem is that you have to use the “* html” hack to get PCIE to behave, however that same code makes MacIE misbehave. So you need to apply a hack to the hack. Eekgads!
Basically the hack for MacIE is a malformed comment in the CSS file, which you wrap around the other hacked code:
/*\*/
MacIE ignores anything in here
/**/
In our case, the previous month’s example hacked code looked like this:
* html #content-right #SiteMapList li { height: 1%; }
If we apply the MacIE hack around that, we get:
/*\*/
* html #content-right #SiteMapList li { height: 1%; }
/**/
Once we do this, we have a declaration that only PC flavours of IE will pay attention to. That hack is very handy and works in most situations. Sometimes though, if you’ve coded yourself into a corner, which I certainly have, or if you’re working on one of “those” projects (you know, where major changes come down the pike after you’ve completed a majority of the site) then there is another way to hack MacIE that I have found very effective.
Since the very first god-awful web page I ever coded, I’ve been a big proponent of doing what you have to do to get HTML to work for you. I guess I’m a code whore. Oh, I enjoy my dash of standards and my heaping teaspoon of “top to bottom logical code flow” or whatever you want to call it, but when it comes time for the client to get what they want I have a hard time saying, “well I could make it happen but then your code wouldn’t validate.”
Go ahead, I’ll wait for your name-calling to end before I go on...
OK, so now that we’ve all sold out, let’s move on to the next Mac hack. It’s a malformed CSS import command. Thar she blows:
@import("macie.css");
With this handy-dandy little fella you can code the night away solely for the MacIE crowd if you wish. Just put it last in line of all your CSS imports, etc, so it overrides anything that came before it. No other browsers will import this bad boy. Now you could theoretically recode the entire CSS if you needed to. Heh, go for it!
Lane MobilSenseI am very pleased with the outcome of this project. A solution that compensates for critical deficiencies in IE support for CSS was provided by John, enabling us to push ahead with a strategy that may not have been possible otherwise. My advice to you if you're considering working with John Barrick on a project is: Do it! I intend to continue working with John on this and other future projects.