CSS: "A man's got to know his limitations"
In several senses.
In 1997, when the concept of CSS was in its infancy (see Celebrating 10 Years with Style), I knew I should pay attention. I bought the first edition of Lie and Bos. But for my purposes, CSS wasn’t ready for prime time. Most web people didn’t understand it. Worse, most browsers didn’t implement CSS properly. (Unfortunately, most browsers are still in the “almost good enough” stage with regard to CSS.)
The startup I had joined was implementing a database backed web application, Recruiter, that was intended to be a software service integrated with customer companies’ sites. It was almost mandatory that Recruiter be able to change appearance to match the customer site appearance. Managing that efficiently across many sites was going to be a challenge. CSS wasn’t yet a viable tool to address the requirement.
I created a set of what I called “appearance modeling” macros in M4, converting from macro definitions to HTML (The Wikipedia M4 page now illustrates use of M4 macros to create HTML, but in 1997 I was not aware of people using M4 with HTML.) Those macros were delightfully effective for Recruiter, and I still use similar macros today for several sites. (See primitives and appearance if you’re really interested. The basic notion is that the primitives are invariant for an application, but the appearance macros are specific to modeling an instance of site appearance. Running M4 against an M4 instance of a page, e.g., chs_bio.m4. yields the desired HTML, e.g., chs_bio.html.)
10 years later, those macros still work, sort of. But they have depended on all sorts of HTML trickery (rightfully!?) despised by CSS advocates. So I spent last month immersing myself in CSS. I’d started to recognize the need when I began investigating Movable Type and WordPress for this and other blogs. But the real impetus was preparing to rework my church’s site to match the appearance and content of a new brochure. Overlapping pictures and similar print-like layout tricks are beyond my HTML skills — if such things can be accomplished with HTML alone, the HTML must be most distasteful. Such tricks are relatively simple with CSS.
At first, I hypothesized that the M4 macros weren’t going to even be useful. I created a home page strictly with CSS and HTML. But as I moved on to other pages, the benefits of using M4 macros to avoid repetitive effort became apparent, as I had suspected would happen. So that site now uses a subset of the macros that used to be used on the site. Using the macros has two benefits. First, reworking the existing pages was much easier for me. Going from the old music page to the new one was part reuse, part creating new styles, part cut and paste from the brochure source files. Second, there are old pages that are unlikely to be reworked, yet still exist in case they remain in bookmarks and search indices. For example, a former pastor’s biography makes sense to retain, but not update. The new version more or less fits with the new appearance, certainly better than the old version.
Now that I am a CSS whiz, there’s also a sense of deja vu regarding discrepancies amongst browsers and their (mis-)implementations of standards. In 1997 it was Navigator 3 and 4 and I.E. 2 and 4 vs. HTML. Today it is Firefox and IE 6 and 7 and Safari vs. CSS. One page that seemed great in I.E. 7, and I believed to be good, or at least, legitimate, CSS/HTML, was a disaster with Firefox. After making that page render decently with Firefox and I.E. 6, the CSS/HTML are kludgey, and it still doesn’t look good in Safari.
Back to Dirty Harry, it still doesn’t look like CSS/HTML are a match for complex print layouts.