i·me·michael

Some days you just can’t get rid of a bomb.¶

i·me·michael header image 2

Come on baby light my FIR

October 10th, 2003 · 4 Comments

So there I was staring the FIR method in the face and asking, “Why Ziploc® the image in the CSS?”

It didn’t seem like reusable code to me. For every piece of content or text you wanted to use the technique on, you needed to add another declaration in your CSS. It becomes sort of impractical to use on dynamic sites, where content changes frequently. Don’t get me wrong, I love the idea from the standpoint of the issues it addresses, and the cleverness with which it does it, but the appeal wears off if I can only use it statically. I mean, I can’t really set this up for all H2 elements on a page, and I can’t apply it to a whole class of elements. Even the Revised Image Replacement techniques, culled at mezzoblue, don’t allow for dynamically achieving this effect. So what’s a codemonkey to do? Well, recode of course!

I went back to the beginning and asked, “What is the goal here? What points are we looking to address?” Well, we’re looking to achieve the following:

  1. Enhance the graphic presentation of pages through the use of images
  2. Keep the content of pages accessible to assistive browsing software, text-only browsers, as well as browsers with images disabled
  3. Promote the proper indexing of content by search robots, and other such data aggregators
  4. Keep the code/markup to a minimum, and avoid adding semantically ambiguous markup

I kept thinking, “Why not use an IMG element for an image?” After all, we’re trying to establish a technique for adding images to a page, while allowing the actual content, the text, to remain accessible. Why remove the IMG element from the document, only to code the image in elsewhere? Why not start with both, and then pseudo-eliminate the text? Since the code for placing images in pages already exists in (X)HTML, why not use it, and just think differently about its purpose for being there?

The purpose, in this case, is largely decorative. It conveys information to those that can view it, but it is supported by textual content, for those that can’t, or don’t wish to view images. It’s no longer the sole responsibility of the image to convey all the information. It now does so jointly, and doesn’t need to be defined in the same way a separate image might. By this, I mean alt or title text. The image needn’t be accessible, since it is there as a decorative enhancement, and is backed up by text, so treat it like any other decorative image and leave the alt attribute empty.

Point of fact, eventually, we are all going to be coding accessible image alternatives in a very similar fashion when we switch from using the IMG element, to the OBJECT element. [ed note—Yes, we know this is the second Mark Pilgrim document we’ve linked to. It couldn’t be helped.]

So instead of adding SPAN elements, and display:none to hide the text, I opted to simply cover it up with the image; similar to the Gilder/Levin method. [ed—We swear we only just noticed the similarity!]

There are two main flaws with the cover-up method. The first problem arises when using transparent images. It’s sort of difficult to hide something behind a pane of glass isn’t it? While I believe it’s possible to work around this in many situations, there will be those times when it simply won’t be workable.

Second, the possibility exists that the text you are trying to hide is longer than the image you are trying to hide it with. Again, this is a situation that can be worked around, but there is always that exception where it will be impractical. The caveat to using any method is to first make sure the implementation fits the needs of the project.

I sent my little mock-up to Dave Shea, just to see what he thought, and though he thought it was interesting, he didn’t feel it added much over using just an image. The reality is that’s true, but it’s true of the entire concept. However the basis here is still the text, not the image. And, this method uses a semantically correct element to insert an image into the document, still uses CSS to alter the presentation, and allows you to use it on any element or class of elements.

I know it’s just a cheesy little mock-up, but it may be a springboard to some other ideas. I may add some other examples and documentation to that page over the weekend.

Tags: General

4 responses so far ↓

  • 1 Michael // Oct 10, 2003 at 5:52 pm

    For me one accessibility drawback of all these methods is that with a text-header you can, as many people do, make it a link.

    I think I have seen a similar solution to your one already but can’t remember where. But I do so admire people who post these solutions. I just put up stuff on hill figures or how to date a hedge or suchlike!

  • 2 Dave S. // Oct 10, 2003 at 10:34 pm

    "The reality is that’s true, but it’s true of the entire concept."

    More or less… except when you consider multiple style sheets. That’s the big reason FIR is so sexy. A site that doesn’t use them doesn’t benefit from FIR much. But anyone wanting a goodly amount of content/presentation cleavage will have their hands tied if they’re forced to use <img>-placed GIFs dithered to a specific background colour. That’s where FIR comes in.

    I actually don’t use FIR much in my commercial work. The accessibility issue still bothers me, and I don’t use alternative style sheets for much more than font resizing. I’m still confident that a method will pop up sooner or later that negates all this, but I don’t think the methods in my summary are there yet.

  • 3 michael // Oct 11, 2003 at 11:27 am

    “But anyone wanting a goodly amount of content/presentation cleavage will have their hands tied if they’re forced to use <img>-placed GIFs dithered to a specific background colour. ”

    Not tied so much, but they will definitely have to plan. There are always PNGs instead of GIFs (although yes, they don’t work so well in IE), and there is always the possibility of dynamically altering the image when you change the stylesheet. It’s always a matter of planning the project.

    And again, I don’t want it to look like I’m condemning the FIR method, or that I’ve come up with the perfect replacement. It’s another viewpoint, and one that may simply lead to something else.

  • 4 michael // Oct 11, 2003 at 11:32 am

    Oh, and Michael, with this method, you can absolutely make the image/text a link. That’s not a problem.

    And your email was what initially prompted me to start playing around with FIR again, so thatnks.

You must log in to post a comment.