Night of the Image Map

by Stuart Robertson

67 Reader Comments

Back to the Article
  1. “We have now taken up the policy that Netscape 4 users no longer have to be supported. In this debate I’m trying to convince everyone that it would be better “gracefully degrade” for Netscape 4 users.”

    Agreed. However, I would say that you still ARE supporting NS 4. As long as all the relevant (or important or mission-critical, or whatever) content and functonality is accessible and usable in NS 4, it is supported. It’s just the presentation that differs.

    My point is that one should be careful with the phrase “no need to support NS 4”, because it could be misinterpreted and (especially when it comes from us “standards” people) used as justification for making web sites that are completely unusable in NS 4.

    Copy & paste the code below to embed this comment.
  2. That’s all very good, but to be honest, CSS-P not image maps. OK maybe calling it image maps is useful for people that want to carry on in the old ways using the new technologies, whatever.

    Now, I was thinking the same as Lim Chee Aun on the <ul> thing.
    And using the CSS preloading hover is a good idea too.

    Copy & paste the code below to embed this comment.
  3. I wound up looking at this article hoping for a solution to a problem I have.  I am trying to display charts that allow for heavy user interaction.  The chart package I use happily provides an easy way to generate an image map.  BUT—the effect I want is for the user to see the each chart region highlighted as the mouse hovers over it.  Imagine the user is presented with a pie chart and when she hovers over a pie slice the border of slice becomes red instead of black.  When the user clicks on the pie slice they get a menu that allows them to manipulate the chart in useful ways (for example change the color of the pie slice or see detail information)

    This sounds like it ought to be a simple straightforward task for an image map, but is not.  I have tried code such as this:
    —————————————code begins————————————
    <html>
    <body>
    <img
    usemap=”#mymap”>
    <map name=“mymap” id=“mymap”>
    <area alt=“1” title=“1” shape=“poly” coords=“60,15,90,15,90,35,60,35”
    tabindex=“1”
       
       
      href=”#” target=“_self” >
    <area id=“area1” alt=“2” title=“2” shape=“poly” tabindex=“2”
    coords=“90,120,110,120,110,140,90,140” href=”#” target=“_self”

       
     
    >
    </map>
    </body>
    </html>
    ———————————————code ends————————————-
    But without success—it does not reliably work. 
    I think that perhaps the only way I will be able to get the effect I want is to build—on the fly—transparent GIFs that show my desired outlines and use a rollover to display them.  This is a pretty heavy weight solution both in terms of server resources and also from a number of images downloaded perspective—but seems to be the only way I am gonna get this effect in a reliable manner.
    Any better ideas out there???  Thanks for reading.

    Copy & paste the code below to embed this comment.
  4. Charles it sounds as if you need a technology like flash or more likely SVG. Transform your charts into an interactive SVG image which can be scripted to provide the functionality that you want. People would then just need adobe’s svg viewer plugin.

    I think there are ways to do it with CSS and HTML but SVG is a more appropriate technology.

    Copy & paste the code below to embed this comment.
  5. I like it too, and it does appear to meet accessibility for those who use screen readers.  However, it does not appear to meet accessibility for people with low vision who do not use screen readers.  I tried changing the font size in Mozilla using View/Text zoom and it (as expected) has no effect.

    So somebody would have to code additional styles in their personal style sheet to navigate this page.  (I don’t see any quick setting in Mozilla to ignore the currently active style sheet.)

    Copy & paste the code below to embed this comment.
  6. This method strikes me as a good way to create html-only versions of graphic-intensive flash sites. I agree, I’d rather use spans and have my markup a little less clear than use a deprecated tag like <i> – call me a purist but it just seems wrong! Maybe use <a> instead? Cool idea overall though.

    Copy & paste the code below to embed this comment.
  7. The idea of css was originally that it was less of a hack than html – more elegant, more maintainable. But now we are seeing so many ‘techniques’ in css which are much more complex that the html methods they replace… such as this one. I don’t approve. css pages still don’t render the same in different browsers anymore than html code did. css has not proven to be an advantage, and this article is one more example of that.

    Copy & paste the code below to embed this comment.
  8. The approach worked better then a map in our application and also reduced the final size of the code. Thank you for taking time to share your solution !! Some of us appreciate your efforts.

    Copy & paste the code below to embed this comment.
  9. This solution, with the enhancements on the li and preload-stuff, seems very logical and flexible to me. For those who aren’t convinced: Imagine how you can print this page. Just make a print-stylesheet and there you go!

    Copy & paste the code below to embed this comment.
  10. Please read Danny Goodman’s “Super-Efficient Image Rollovers” [1] featuring a 3-state rollover client-side image map—CSS + JavaScript combo. It works will all W3C DOM-compatible browsers (not tested with Safari though) and web crawlers!

    [1] http://www.oreillynet.com/pub/a/javascript/2003/07/01/bonusrecipe.html

    Copy & paste the code below to embed this comment.
  11. In my summer job I ran accross a similar problem and reached a slightly different solution.  Keep in mind though that I was designing only for IE6 (not a project that went to the web) so I was free of many constraints and constrained in many other ways.

    I kept the background image just one whole image with the actual lettering (non glowing).  I made an invisible link over the lettering (absolutely positioned) that contained a hidden (visibility: hidden;) image (the glowing lettering) that was shown by calling a javascript function when the mouse over rolled over (onmouseover) and hid it when it was rolled out (onmouseout).

    Of course this doesn’t rely purely on XHTML and CSS and I didn’t really look into accessiblity and other such issues, but it was definely a lot less code than this technique and seems sound.  I am sure with just a little more code this can be made accessible as well.

    Copy & paste the code below to embed this comment.
  12. Nice article. Unfortunalley it will only work in IE 5 and 6, if image is located in the upper-left corner.

    If you set the body.margin to 50px, then it does not work. Althoug the CSS Map should be relative to the parent div object.

    Copy & paste the code below to embed this comment.
  13. I really liked this article as it solved a problem for me with Elastic Design (see the “Elastic Design” article else where on this site).  I was trying to create an elastic design where the images would scale in proportion to the rest of the text on the page.  The problem was the specs required that certain images be clickable via image maps.  How do you get an image map to scale when all of the coords are specified in pixels?  Answer, you can’t.  This method does however!

    I’m including my sample code below so I can point out one minor problem I found in IE6.  For the longest time, I couldn’t seem to click on the area I had defined except when I was directly over the small border I had made around the link (so I could see it).  If I removed the border, I couldn’t click on the link at all!  The answer seemed to lie with the background of the link.  As soon as I set one, I could click on the area.  We use a single transparent GIF in our pages for tracking and other purposes, which made me decide to try using it as a transparent background for the link.  This solved the problem.  Here’s the code in case any one else wants to review it.

    <html>
    <head>
      <title>Untitled</title>
      <style>
      body {
        font: 60%;
        color: #000000;
        margin-left: 50px;
      }
     
      div {
        margin: 0px;
        padding: 0px;
      }

      div#Charlize {
        width: 13.8em;
        height: 6.6em;
        position: relative;
      }
     
      img#Charlize {
        width: 13.8em;
        height: 6.6em;
      }

      #menu {
        position: relative;
      }

      #menu a i {
        visibility: hidden;
      }

      #menu a {
        position: absolute;
        text-decoration: none;
        border: solid 1px red;
        background: url(“s.gif”);
        width: 3.75em;
        height: 1em;
        top: 1.2em;
        left: 7em;
      }

      #menu a:hover {
        border: solid 1px yellow;
      }
      </style>
    </head>

    <body>


    <div id=“Charlize”>
      <div id=“menu”>
      eyes
      </div>
      hp_spotlight_CharlizeTheron1.jpg
    </div>

    </body>
    </html>

    Copy & paste the code below to embed this comment.
  14. In “Separate CSS file”…, Gabe wrote:

    If you use Safari, try the Activity window. It gives a list of all open URLs and components of those pages so you can get to the stylesheet (and anything else) quickly.

    This is fantastic! I can’t believe I didn’t already know this. I’ll use this daily.

    Thanks for the valuable hint Gabe.

    Copy & paste the code below to embed this comment.
  15. I have coded a similar imagemap with text and image pop-ups) on www.jumbotours.co.jp/e/index.html but i’m puzzled with IE 6.0 behaviour. The list items are really close together and sometimes another underlying list/link show up through the pop-up. Any ideas?

    Copy & paste the code below to embed this comment.
  16. Cool! Answered my question (discussion page 2): http://www.alistapart.com/d/sprites/ala-blobs2.html

    Copy & paste the code below to embed this comment.
  17. I think, that in example very hard pictures :(
    In the net with slow modem this page will download very very long time…

    Copy & paste the code below to embed this comment.