W3C home > Mailing lists > Public > public-css-archive@w3.org > January 2017

[csswg-drafts] transform-origin: 0% not equivalent to 0px is confusing

From: Simon Fraser via GitHub <sysbot+gh@w3.org>
Date: Thu, 12 Jan 2017 17:10:39 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-200425777-1484241038-sysbot+gh@w3.org>
smfr has just created a new issue for 
https://github.com/w3c/csswg-drafts:

== transform-origin: 0% not equivalent to 0px is confusing ==
https://www.w3.org/mid/525F2287.8050002@mcc.id.au

I think the behaviour of transform-origin, where lengths mean 
different 
things depending on whether the element is an SVG element or not, 
isn't 
great.  It leads to questions like:

- Why shouldn't 'transform-origin: 0px 0px' and 'transform-origin: 0% 
0%' mean the same thing?  Surely 0% of anything is 0, and so that 
should 
be equivalent to 0px.

- How do we treat 'transform-origin: calc(0% + 0px) calc(0% + 0px)'?


What about having something in the property value that explicitly opts
 
in to having values be relative to the SVG viewport rather than the 
bounding box?  For example:

   transform-origin: viewport 50% 50%;  /* middle of the viewport */
   transform-origin: 50% 50%;           /* middle of the bbox */
   transform-origin: viewport 4px 4px;  /* relative to viewport origin
 */
   transform-origin: 4px 4px;           /* relative to the bbox origin
 */

And then the UA style sheet could set

   transform-origin: viewport 0 0;

on SVG elements.


Alternatively, since setting the transform origin to be anything 
viewport relative except for the origin isn't that useful -- and could
 
be handled by translations in the 'transform' property -- we could 
just 
add a single new value which means the viewport origin for SVG 
elements, 
and the bbox origin for other elements:

   transform-origin: auto;

This would then be the initial value, no need for a UA style sheet 
rule. 
  Percentages and lengths would always be relative to the bbox.


Even if we don't do either of these, and leave the "percentages are 
interpreted differently" behaviour, we should define what happens with
 
calc()s that contain percentages.

Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/895 using your GitHub 
account
Received on Thursday, 12 January 2017 17:10:45 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:07 UTC