W3C home > Mailing lists > Public > www-style@w3.org > February 2012

Re: [css3-transforms] Why do we need a 'perspective' property?

From: Simon Fraser <smfr@me.com>
Date: Mon, 06 Feb 2012 20:48:13 +0100
Cc: "www-style@w3.org list" <www-style@w3.org>
Message-id: <FBD2DE6A-080F-4DEF-BCC0-68AC10E506CC@me.com>
To: Aryeh Gregor <ayg@aryeh.name>
[Please don't cc: people who are on www-style anyway]

On Feb 6, 2012, at 8:44 PM, Aryeh Gregor wrote:

> We have a perspective() function already for transforms.  Why do we
> also need a separate 'perspective' property?  If I want something like
> 
> <div style="height:100px;width:100px;perspective:1000px">
> <div style="height:100px;width:100px;background:lime;
> transform:rotatex(45deg)">
> Some text</div></div>
> 
> why can't I just do
> 
> <div style="height:100px;width:100px;background:lime;
> transform:perspective(1000px) rotatex(45deg)">
> Some text</div>
> 
> instead?  Handling of 'perspective' seems to complicate 3D transforms
> significantly, particularly the way it only applies to children and
> not other descendants, and I don't understand the benefit.

The point of the perspective property is to provide a common perspective
for child elements (and, if you're in a 3d rendering context, for all members
of that context). This is especially useful if the children have different x/y offsets
due to normal CSS layout; they'll still share a common perspective origin.

This avoids the need to have multiple transformed elements all specify 
perspective() in their transforms, with possibly different perspective origins.

Simon
Received on Monday, 6 February 2012 19:49:14 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:50 GMT