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:35:35 -0700
Message-ID: <CAAWBYDDkDD=FnTtENLHSA8+z2XWtKA8o5Xez=rSTnnBUzdtJww@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:30 PM, Andrea Rendine
<master.skywalker.88@gmail.com> wrote:
> SVG can be resized. Everything inside it cannot, as far as it is not defined
> by relative units.

If you use percentage coordinates, or use px coordinates plus a
viewBox attribute on the <svg>, the stuff inside resizes along with
the <svg> container just fine.

> And percentage is not limited to ingegers, of course, but
> it requires a value conversion.

That math is done to sub-pixel accuracy.  It's not anything you need
to worry about.

> And I'm not sure it works with polygons.

Polygons implicitly use the px unit (the "no unit" unit), so you just
need to put a viewBox on the SVG to make them resize with the <svg>
root.

~TJ
Received on Friday, 20 March 2015 20:36:19 UTC

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