W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2015

Re: [whatwg] Responsive image maps

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 20 Mar 2015 13:15:38 -0700
Message-ID: <CAAWBYDDkyUHzVwrF8=EjoFAzrkBrnJF-VD15=f9TNPE98m6Z7g@mail.gmail.com>
To: Andrea Rendine <master.skywalker.88@gmail.com>
Cc: WHATWG List <whatwg@whatwg.org>, Martin Janecke <whatwg.org@prlbr.com>
On Fri, Mar 20, 2015 at 1:00 PM, Andrea Rendine
<master.skywalker.88@gmail.com> wrote:
> About SVG, I made a couple of tests and they are far from being
> comprehensive, but this is the fact. SVG image "maps" need to define 2
> elements for each "area", i.e. the element itself and its associated
> hyperlink.

That's really not much:

<svg width=... height=...>
  <image src=foo ... />
  <a href=target1><polygon points="..." /></a>
  <a href=target2><rect ... /></a>
  ...
</svg>

The markup complexity seems to be about the same as using
<img>/<map>/<area>, especially if you accompany it with prose like the
example in <https://html.spec.whatwg.org/multipage/embedded-content.html#the-map-element>
shows.

> And while SVG graphics offers a wider range of instruments, such
> a complexity is not always of much use. As such it could be useless to
> vectorially define parts of the image when the purpose is just to apply a
> series of shaped links on a preexisting "layer-0" image, as it could happen
> with geographical maps, non-vectorial logos/charts, pre-elaborated graphics.
> What is important, instead, is that inline SVG images cannot be resized with
> CSS. And as such they aren't responsive, exactly as image maps.

<svg> elements can be resized by the CSS 'width' and 'height'
properties just fine.

> The only
> case where CSS resize applies to SVG graphics is when they're used as source
> for <img> tag (apart from IE). And in that case hyperlinks are disabled.
> What we are left with is relative measurement, expressed in percentage for
> example, but IMHO this is not optimal. On one hand, measuring on base 100
> decreases precision,

Percentages are not "base 100".  They're full decimal numbers.  You're
not limited to integer percentages.

~TJ
Received on Friday, 20 March 2015 20:16:23 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:29 UTC