April 14, 2004

Sometimes, A House of Cards

Two hours go by and I still couldn't figure out why the navigation links weren't clickable in IE/Mac. This was one of those times I find myself cursing, putting off lunch and cranking Journey until I figure it out.
Process of elimination got me nowhere. Remove one rule, they work -- but the layout is off. Remove the same rule, along with 10 others and they don't work -- but the layout remains stable. Repeat.
Another hour passes. Journey's Greatest Hits is on shuffle (there is something about the combination of Steve Perry and CSS. I can't quite put my finger on it). Aha! If I remove position: relative; from the element that follows the navigation -- everything works. Of course.
The preceding scenario doesn't happen every day, but when it does, it's a roller-coaster ride of sheer anger, followed by the greatest elation one could possibly receive from writing code. Don't take this the wrong way -- I love CSS. I couldn't get by without it, but on those rare (or sometimes not-so-rare) occurrences when a complex CSS layout becomes a "house of cards", it can sometimes be enough to scare you into realizing, "whoa, I just spent three hours trying to figure out this one small problem for one browser".
You may be wondering about the specifics of my aforementioned troubles. But I couldn't begin to document the 4,723 steps it took me to get to where I was and the equal number of steps to get back only to fix the problem with a single rule deletion. *Sigh*.
Doug waxed poetic on this subject back in January. That it's wise to factor in extra time when planning for cross-browser CSS debugging.
What's amazing to me is that changing one rule, that by all obvious appearances has nothing to do with the problem, can sometimes be all it takes to fix the entire issue. The lesson here? When something doesn't work, try the obvious -- but don't forget the unobvious.