W3C home > Mailing lists > Public > www-svg@w3.org > December 2014

Are percentage lengths relative to viewport or viewbox?

From: Олег Максименко <olegmax@gmail.com>
Date: Mon, 29 Dec 2014 13:11:10 +0300
Message-ID: <CAH1w3sS55+tiRd_OTRc9CW85s+1KfHsGSZvvjtTryPe9KarZSQ@mail.gmail.com>
To: www-svg@w3.org
Reading Specification 1.1 I get the idea that percentage length values are
defined as relative to the viewport, and viewbox/preserveAspectRatio is
just some handy feature that is mapped to transformation.
But playing with some SVG implementations I found that percentages are
actually relative to viewbox (it become apparent when aspect ratio is
changed by viewbox/preserveAspectRatio) and replacing viewbox attribute
with corresponding transformations doesn't work when percentage lengths are
used in descendant elements.
E.g. in sample
http://www.w3.org/TR/SVG/images/coords/PreserveAspectRatio.svg viewport is
blue rectangle, but rect(0,0,100%,100%) will coincide with red rectangle of
Am I missing some nuance in specification?

Thank you,
Received on Monday, 29 December 2014 10:11:36 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:58 UTC