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

[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 UTC