Grow your CSS skills. Land your dream job.

transform-style

Last updated on:

The transform-style property, when applied to an element, determines if that element's children are positioned in 3D space, or flattened.

.parent {
    transform-style: preserve-3d;
}

It accepts one of two values: flat (the default) and preserve-3d. To demonstrate the difference between the two values, click the toggle button in the CodePen below:

Check out this Pen!

When the button is clicked, the demo uses JavaScript to toggle the transform-style value between preserve-3d and flat.

As you can see, when the value is changed to flat, the child elements are no longer stacked according the the translateZ values (in 3D space), but instead flatten out to appear the way elements are by default on an HTML page.

Related Properties

Other Resources

Browser Support

Chrome Safari Firefox Opera IE Android iOS
12+ 4+ 10+ 15+ None 3.0+ 3.2+

All browsers require vendor prefixes, except Firefox 16+. Opera uses -webkit- as of version 15 and the Blink conversion.

IE10 supports 3D transforms, but does not support the transform-style property.

Comments

  1. Permalink to comment#

    Opera supports transform-style since version 15.

  2. Goon
    Permalink to comment#

    IE is the worst browser in the world. I wish Microsoft to buy Mozilla or at least Opera.. So IE can finally rest in peace… Damn…

    • Eddie Prislac
      Permalink to comment#

      Too right. How can a company with all of Microsoft’s resources lag so far behind every other browser in terms of feature adoption?

    • Kevin
      Permalink to comment#

      I think it’s by design. From what I have observed with Microsoft, I think the problem is that they have too many resources in the area of browser development. They innovated plenty in the early IE stages (including the invention of AJAX) but got too much into their own “standards” in later releases. That unconventional progress became the snake that ate it’s own tail. Now we just have crap. Thanks Microsoft…

  3. Vasiliy

    Internet Explorer supports transform-style since version 11

Leave a Comment

Posting Code

Markdown is supported in the comment area, so you can write inline code in backticks like `this` or multiline blocks of code in in triple backtick fences like ```this```. You don't need to escape code in backticks, Markdown does that for you.

Sadly, it's kind of broken. WordPress only accepts a subset of HTML in comments, which makes sense, because certainly some HTML can't be allowed, like <script> tags. But this stripping happens before the comment is processed by Markdown (via Jetpack). It seems to me that would be reversed, because after Markdown processes code in backticks, it's escaped, thus safe. If you think you can fix this issue, get in touch!

If you need to make sure the code (typically HTML) you post absolutely posts correctly, escape it and put it within <pre><code> tags.

Current ye@r *

*May or may not contain any actual "CSS" or "Tricks".