Re: [whatwg] Responsive image maps

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