The transform-style property decides whether nested elements stay in 3D space or get flattened — essential for cubes, flips, and layered 3D scenes.
01
3D space
Child depth.
02
flat
Default.
03
preserve-3d
Keep depth.
04
Nested
Parent/child.
05
perspective
View depth.
06
Cubes
6 faces.
Fundamentals
Introduction
The transform-style property in CSS is used to specify how nested elements are rendered in 3D space. It determines whether the children of an element are flattened into the plane of the element itself or whether they retain their 3D position relative to the parent.
This property is particularly useful when working with 3D transforms and creating 3D effects on web pages.
Definition and Usage
Use transform-style: preserve-3d on a parent container when child elements each have their own 3D transforms and must appear as one cohesive 3D object — like a cube made from six faces.
💡
Beginner Tip
With the default flat value, child 3D transforms may look collapsed. Switch the parent to preserve-3d and add perspective on an ancestor to reveal true depth.
Foundation
📝 Syntax
The syntax for the transform-style property is simple. It can be applied to any element that supports transforms.
Apply on the direct parent of 3D-transformed children.
Pair with perspective on a parent for visible depth.
Child faces usually need position: absolute and their own transform.
The property is not inherited.
Related Properties
transform — moves and rotates elements in 2D/3D
perspective — sets viewing distance for 3D scenes
transform-origin — sets the pivot for transforms
backface-visibility — hides the reverse side during 3D flips
Defaults
🎯 Default Value
The default value of the transform-style property is flat. This means that by default, the children of an element are rendered in the 2D plane of the parent element.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Default value
flat
Keep 3D children
transform-style: preserve-3d;
Flatten children
transform-style: flat;
Often paired with
perspective and child transform
Common use case
3D cubes and card flips
Inherited
No
Reference
💎 Property Values
The transform-style property accepts two keyword values.
Value
Example
Description
flat
transform-style: flat;
This value indicates that the children of the element are flattened into the 2D plane of the element.
preserve-3d
transform-style: preserve-3d;
This value indicates that the children of the element should retain their 3D position relative to the parent element.
flatpreserve-3d
Context
When to Use transform-style
transform-style is required when nested elements must share one 3D scene:
3D cubes and boxes — Six faces positioned with translateZ and rotations.
Card flip animations — Front and back faces rotate in 3D space.
Layered 3D galleries — Multiple panels at different Z depths.
Product showcases — Rotating objects built from child elements.
Preview
👀 Live Preview
Two simplified scenes with front and back faces — preserve-3d keeps depth visible:
flat
preserve-3d
Hands-On
Examples Gallery
In this example, we’ll create a 3D cube using the transform-style property set to preserve-3d to maintain the 3D positioning of the cube faces.
📜 3D Structures
Build multi-face objects that rotate as one unit in 3D space.
Example 1 — 3D cube with preserve-3d
In this example, we’ll create a 3D cube using the transform-style property set to preserve-3d to maintain the 3D positioning of the cube faces.
Perspective on the scene sets viewing distance; preserve-3d on the object keeps child transforms in true 3D space.
A11y
♿ Accessibility
Reduced motion — Disable or simplify 3D flip animations when prefers-reduced-motion: reduce is set.
Do not rely on 3D alone — Ensure content is readable without hover or rotation effects.
Avoid disorientation — Heavy 3D motion on large areas can distract or confuse users.
Keyboard access — Flippable cards should be operable without hover-only interaction.
Companion
The 3D transform stack
A working 3D effect usually combines perspective on an ancestor, transform-style: preserve-3d on the parent, and individual transform values on children.
Choose flat to collapse or preserve-3d to keep depth.
Mode
3
Browser renders scene
With perspective, children appear at different depths in one 3D space.
Render
=
✅
Cohesive 3D object
Faces and layers move together as a realistic 3D shape.
Compatibility
Browser Compatibility
The transform-style property is supported in most modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. However, it is always a good practice to test your website across different browsers to ensure compatibility.
✓ Modern browsers · Widely supported
3D rendering in CSS
preserve-3d works in current Chrome, Firefox, Safari, Edge, and Opera for 3D cubes and flips.
97%Browser support
Google Chrome36+ · Desktop & Mobile
Full support
Mozilla Firefox16+ · Desktop & Mobile
Full support
Apple Safari9+ · macOS & iOS
Full support
Microsoft Edge12+ · All versions
Full support
Opera23+ · All versions
Full support
Testing tip
Test 3D flips and cubes on mobile Safari; stacking contexts from overflow: hidden can break preserve-3d.
transform-style property97% supported
Bottom line:transform-style: preserve-3d is reliable for modern 3D CSS effects when paired with perspective.
Wrap Up
Conclusion
The transform-style property is a powerful tool for web developers working with 3D transformations.
By controlling whether child elements are flattened or retain their 3D position, you can create complex and visually appealing 3D effects. Experiment with this property to see how it can enhance the depth and realism of your web designs.