CSS3 3D Transform Style Property

Here is the brief description of how to specify, how the nested elements are rendered in 3D space in CSS3 using the CSS3 transform-style property.


Property :

transform-style: flat|preserve-3d|initial|inherit;

flat - Specifies that child elements will NOT preserve its 3D position.
preserve-3d - Specifies that child elements will preserve its 3D position.
initial - Sets this property to its default value.
inherit - Inherits this property from its parent element.


transform-style: preserve-3d;


The transform-style property specifies how nested elements are rendered in 3D space.
Note: This property must be used together with the transform property.

Example :
#div1 {
border: 2px solid grey;
height: 100px;
padding: 5px;
position: relative;
width: 120px;
#div2 {
background-color: yellow;
padding: 15px;
position: absolute;
transform: rotateY(60deg);
transform-style: preserve-3d;
#div3 {
background-color: green;
padding: 20px;
position: absolute;
transform: rotateY(-60deg);
<br> <div id="div1">
<div id="div2">YELLOW
<div id="div3">GREEN</div>



Ask Questions

Ask Question