Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJake Almendarez
Front End Web Development Techdegree Student 4,250 Pointsposition absolute
if there is no other positioned elements then how are all those faces staying relative to the photo cube???
1 Answer
Francisco J Romo
8,568 PointsI had the same question so I did some digging...
When you set the perspective property of a container with a value other than none, this creates a new stacking context.
In the video example he sets the perspective of the cube-container to 800px, thus setting a new containing block (in other words this is the new positioned parent). Then he can position the elements contained inside photo-cube container by setting their position absolute inside this new context. Otherwise the translations would be relative to each element initial position.
For more info: https://developer.mozilla.org/en-US/docs/Web/CSS/perspective#description