Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      How To Prevent WordPress SQL Injection Attacks

      June 14, 2025

      This week in AI dev tools: Apple’s Foundations Model framework, Mistral’s first reasoning model, and more (June 13, 2025)

      June 13, 2025

      Open Talent platforms emerging to match skilled workers to needs, study finds

      June 13, 2025

      Java never goes out of style: Celebrating 30 years of the language

      June 12, 2025

      6 registry tweaks every tech-savvy user must apply on Windows 11

      June 14, 2025

      Here’s why network infrastructure is vital to maximizing your company’s AI adoption

      June 14, 2025

      The AI video tool behind the most viral social trends right now

      June 14, 2025

      Got a new password manager? How to clean up the password mess you left in the cloud

      June 14, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Right Invoicing App for iPhone: InvoiceTemple

      June 14, 2025
      Recent

      Right Invoicing App for iPhone: InvoiceTemple

      June 14, 2025

      Tunnel Run game in 170 lines of pure JS

      June 14, 2025

      Integrating Drupal with Salesforce SSO via SAML and Dynamic User Sync

      June 14, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Windows 11 24H2 tests toggle to turn off Recommended feed in the Start menu

      June 14, 2025
      Recent

      Windows 11 24H2 tests toggle to turn off Recommended feed in the Start menu

      June 14, 2025

      User calls Windows 11 “pure horror,” Microsoft says it’s listening to feedback

      June 14, 2025

      John the Ripper is an advanced offline password cracker

      June 14, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»Revisiting Image Maps

    Revisiting Image Maps

    April 30, 2025

    I mentioned last time that I’ve been working on a new website for Emmy-award-winning game composer Mike Worth. He hired me to create a highly graphical design that showcases his work.

    Mike loves ’90s animation, particularly Disney’s Duck Tales and other animated series. He challenged me to find a way to incorporate their retro ’90s style into his design without making it a pastiche. But that wasn’t my only challenge. I also needed to achieve that ’90s feel by using up-to-the-minute code to maintain accessibility, performance, responsiveness, and semantics.

    Design by Andy Clarke, Stuff & Nonsense. Mike Worth’s website will launch in April 2025, but you can see examples from this article on CodePen.

    Designing for Mike was like a trip back to when mainstream website design seemed more spontaneous and less governed by conventions and best practices. Some people describe these designs as “whimsical”:

    adjective

    1. spontaneously fanciful or playful
    2. given to whims; capricious
    3. quaint, unusual, or fantastic

    — Collins English Dictionary

    But I’m not so sure that’s entirely accurate. “Playful?” Definitely. “Fanciful?” Possibly. But “fantastic?” That depends. “Whimsy” sounds superfluous, so I call it “expressive” instead.

    Studying design from way back, I remembered how websites often included graphics that combined branding, content, and navigation. Pretty much every reference to web design in the ’90s — when I designed my first website — talks about Warner Brothers’ Space Jam from 1996.

    Space Jam website homepage. The movie logo is in the center of a series of planets that are navigation for other areas of the website against a dark starry background.
    Warner Brothers’ Space Jam (1996)

    So, I’m not going to do that.

    Brands like Nintendo used their home pages to direct people to their content while making branded visual statements. Cheestrings combined graphics with navigation, making me wonder why we don’t see designs like this today. Goosebumps typified this approach, combining cartoon illustrations with brightly colored shapes into a functional and visually rich banner, proving that being useful doesn’t mean being boring.

    Left to right: Nintendo, Cheestrings, Goosebumps.

    In the ’90s, when I developed graphics for websites like these, I either sliced them up and put their parts in tables or used mostly forgotten image maps.

    A brief overview of properties and values

    Let’s run through a quick refresher. Image maps date all the way back to HTML 3.2, where, first, server-side maps and then client-side maps defined clickable regions over an image using map and area elements. They were popular for graphics, maps, and navigation, but their use declined with the rise of CSS, SVG, and JavaScript.

    <map> adds clickable areas to a bitmap or vector image.

    <map name="projects">
      ...
    </map>

    That <map> is linked to an image using the usemap attribute:

    <img usemap="#projects" ...>

    Those elements can have separate href and alt attributes and can be enhanced with ARIA to improve accessibility:

    <map name="projects">
      <area href="" alt="" … />
      ...
    </map>

    The shape attribute specifies an area’s shape. It can be a primitive circle or rect or a polygon defined by a set of absolute x and y coordinates:

    <area shape="circle" coords="..." ... />
    <area shape="rect" coords="..." ... />
    <area shape="poly" coords="..." ... />

    Despite their age, image maps still offer plenty of benefits. They’re lightweight and need (almost) no JavaScript. More on that in just a minute. They’re accessible and semantic when used with alt, ARIA, and title attributes. Despite being from a different era, even modern mobile browsers support image maps.

    A large illustrated map of a cartoon island.
    Design by Andy Clarke, Stuff & Nonsense. Mike Worth’s website will launch in April 2025, but you can see examples from this article on CodePen.

    My design for Mike Worth includes several graphic navigation elements, which made me wonder if image maps might still be an appropriate solution.

    Image maps in action

    Mike wants his website to showcase his past work and the projects he’d like to do. To make this aspect of his design discoverable and fun, I created a map for people to explore by pressing on areas of the map to open modals. This map contains numbered circles, and pressing one pops up its modal.

    A large illustrated cartoon map of an island. 6 annotations are on the map and a tooltip is exposed showing detail of one of the annotations.

    My first thought was to embed anchors into the external map SVG:

    <img src="projects.svg" alt="Projects">
    
    <svg ...>
      ...
      <a href="...">
        <circle cx="35" cy="35" r="35" fill="#941B2F"/>
        <path fill="#FFF" d="..."/>
      </a>
    </svg>

    This approach is problematic. Those anchors are only active when SVG is inline and don’t work with an <img> element. But image maps work perfectly, even though specifying their coordinates can be laborious. Fortunately, plenty of tools are available, which make defining coordinates less tedious. Upload an image, choose shape types, draw the shapes, and copy the markup:

    <img src="projects.svg" usemap="#projects-map.svg">
    
    <map name="projects-map.svg">
      <area href="" alt="" coords="..." shape="circle">
      <area href="" alt="" coords="..." shape="circle">
      ...
    </map>

    Image maps work well when images are fixed sizes, but flexible images present a problem because map coordinates are absolute, not relative to an image’s dimensions. Making image maps responsive needs a little JavaScript to recalculate those coordinates when the image changes size:

    function resizeMap() {
      const image = document.getElementById("projects");
      const map = document.querySelector("map[name='projects-map']");
      
      if (!image || !map || !image.naturalWidth) return;
      
      const scale = image.clientWidth / image.naturalWidth;
      map.querySelectorAll("area").forEach(area => {
      
        if (!area.dataset.originalCoords) {
          area.dataset.originalCoords = area.getAttribute("coords");
        }
    
        const scaledCoords = area.dataset.originalCoords
        
        .split(",")
        .map(coord => Math.round(coord * scale))
        .join(",");
        area.setAttribute("coords", scaledCoords);
      });
    }
    
    ["load", "resize"].forEach(event =>
      window.addEventListener(event, resizeMap)
    );

    I still wasn’t happy with this implementation as I wanted someone to be able to press on much larger map areas, not just the numbered circles.

    Every <path> has coordinates which define how it’s drawn, and they’re relative to the SVG viewBox:

    <svg width="1024" height="1024">
      <path fill="#BFBFBF" d="…"/>
    </svg>

    On the other hand, a map’s <area> coordinates are absolute to the top-left of an image, so <path> values need to be converted. Fortunately, Raphael Monnerat has written PathToPoints, a tool which does precisely that. Upload an SVG, choose the point frequency, copy the coordinates for each path, and add them to a map area’s coords:

    <map>
      <area href="" shape="poly" coords="...">
      <area href="" shape="poly" coords="...">
      <area href="" shape="poly" coords="...">
      ...
    </map>

    More issues with image maps

    Image maps are hard-coded and time-consuming to create without tools. Even with tools for generating image maps, converting paths to points, and then recalculating them using JavaScript, they could be challenging to maintain at scale.

    <area> elements aren’t visible, and except for a change in the cursor, they provide no visual feedback when someone hovers over or presses a link. Plus, there’s no easy way to add animations or interaction effects.

    But the deal-breaker for me was that an image map’s pixel-based values are unresponsive by default. So, what might be an alternative solution for implementing my map using CSS, HTML, and SVG?

    A large illustrated map of a cartoon island cut out against a transparent background.

    Anchors positioned absolutely over my map wouldn’t solve the pixel-based positioning problem or give me the irregular-shaped clickable areas I wanted. Anchors within an external SVG wouldn’t work either.

    But the solution was staring me in the face. I realized I needed to:

    1. Create a new SVG path for each clickable area.
    2. Make those paths invisible.
    3. Wrap each path inside an anchor.
    4. Place the anchors below other elements at the end of my SVG source.
    5. Replace that external file with inline SVG.
    The same illustrated map of an island but the six regions are represented by solid colors.

    I created a set of six much larger paths which define the clickable areas, each with its own fill to match its numbered circle. I placed each anchor at the end of my SVG source:

    <svg … viewBox="0 0 1024 1024">
    
      <!-- Visible content -->
      <g>...</g>
    
      <!-- Clickable areas -->`
      <g id="links">`
        <a href="..."><path fill="#B48F4C" d="..."/></a>`
        <a href="..."><path fill="#6FA676" d="..."/></a>`
        <a href="..."><path fill="#30201D" d="..."/></a>`
        ...
      </g>
    </svg>

    Then, I reduced those anchors’ opacity to 0 and added a short transition to their full-opacity hover state:

    #links a {
      opacity: 0;
      transition: all .25s ease-in-out;
    }
    
    #links a:hover {
      opacity: 1;
    }

    While using an image map’s <area> sadly provides no visual feedback, embedded anchors and their content can respond to someone’s action, hint at what’s to come, and add detail and depth to a design.

    The illustrated regions of the cartoon map in three states, from left to right: annotated, with visual markers, and with both visual markers and labels.

    I might add gloss to those numbered circles to be consistent with the branding I’ve designed for Mike. Or, I could include images, titles, or other content to preview the pop-up modals:

    <g id="links">
      <a href="…">
        <path fill="#B48F4C" d="..."/>
        <image href="..." ... />
      </a>
    </g>

    Try it for yourself:

    CodePen Embed Fallback

    Expressive design, modern techniques

    Designing Mike Worth’s website gave me a chance to blend expressive design with modern development techniques, and revisiting image maps reminded me just how important a tool image maps were during the period Mike loves so much.

    Ultimately, image maps weren’t the right tool for Mike’s website. But exploring them helped me understand what I really needed: a way to recapture the expressiveness and personality of ’90s website design using modern techniques that are accessible, lightweight, responsive, and semantic. That’s what design’s about: choosing the right tool for a job, even if that sometimes means looking back to move forward.


    Biography: Andy Clarke

    Often referred to as one of the pioneers of web design, Andy Clarke has been instrumental in pushing the boundaries of web design and is known for his creative and visually stunning designs. His work has inspired countless designers to explore the full potential of product and website design.

    Andy’s written several industry-leading books, including Transcending CSS, Hardboiled Web Design, and Art Direction for the Web. He’s also worked with businesses of all sizes and industries to achieve their goals through design.

    Visit Andy’s studio, Stuff & Nonsense, and check out his Contract Killer, the popular web design contract template trusted by thousands of web designers and developers.


    Revisiting Image Maps originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleRilasciato Mozilla Thunderbird 138: tutte le novità per la gestione della posta su GNU/Linux
    Next Article Distribution Release: AnduinOS 1.3.0

    Related Posts

    News & Updates

    6 registry tweaks every tech-savvy user must apply on Windows 11

    June 14, 2025
    News & Updates

    Here’s why network infrastructure is vital to maximizing your company’s AI adoption

    June 14, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    CVE-2025-26396 – SolarWinds Dameware Mini Remote Control Local Privilege Escalation Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-24351 – CtrlX OS Remote Command Execution Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-4205 – WordPress Popup Maker Stored Cross-Site Scripting Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    How to prevent your PC from locking automatically on Windows 11

    News & Updates

    Highlights

    CVE-2025-4803 – WPPedia PHP Object Injection Vulnerability

    May 21, 2025

    CVE ID : CVE-2025-4803

    Published : May 21, 2025, 12:16 p.m. | 2 hours, 34 minutes ago

    Description : The Glossary by WPPedia – Best Glossary plugin for WordPress plugin for WordPress is vulnerable to PHP Object Injection in all versions up to, and including, 1.3.0 via deserialization of untrusted input from the ‘posttypes’ parameter. This makes it possible for authenticated attackers, with Administrator-level access and above, to inject a PHP Object. No known POP chain is present in the vulnerable software, which means this vulnerability has no impact unless another plugin or theme containing a POP chain is installed on the site. If a POP chain is present via an additional plugin or theme installed on the target system, it may allow the attacker to perform actions like delete arbitrary files, retrieve sensitive data, or execute code depending on the POP chain present.

    Severity: 7.2 | HIGH

    Visit the link for more details, such as CVSS details, affected products, timeline, and more…

    Perficient Included in Forrester’s AI Technical Services Landscape, Q2 2025

    June 3, 2025

    How to Sort Dates Efficiently in JavaScript

    May 30, 2025

    Skype is dead — Microsoft drops the call after 14 years of neglect to favor Teams: “We know this is a big deal for our users”

    May 5, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.