HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials
  • Insights
  • Verify Certificate
HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials
HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials

HTML5andCSS3.org helps developers learn modern frontend skills with practical tutorials, production-ready snippets, and fast web tools built for everyday coding.

Quick Links

  • About Us
  • Contact Us
  • Privacy Policy
  • Copyright
  • Disclaimer

Top Tools

  • Try It Editor
  • JSON Formatter
  • CSS Minifier
  • HTML Minifier
  • Base64 Encoder / Decoder

Contact

  • business@html5andcss3.org
Newsletter

Learn at your own pace, practice with useful tools, and build websites you're proud of.

© 2011-2026 html5andcss3.org. All rights reserved.

How to Use

CSS Tutorial

CSS Introduction

What is CSSCSS SyntaxHow to Add CSSCSS Comments

CSS Foundations

Cascade & InheritanceCSS SpecificityCSS UnitsBox SizingCSS VariablesCSS Math Functions

CSS Selectors

CSS Element SelectorCSS Class SelectorCSS ID SelectorCSS Universal SelectorCSS Group SelectorCSS CombinatorsCSS Attribute SelectorsCSS Pseudo ClassesCSS Pseudo Elements

CSS Colors and Backgrounds

CSS ColorsCSS HEX ColorsCSS RGB ColorsModern ColorsCSS Background ColorCSS Background ImageLayered Backgrounds

CSS Text & Fonts

CSS Text ColorCSS Text AlignmentCSS Text DecorationCSS Font FamilyCSS Font SizeWeb Fonts & TypographyText Wrapping

CSS Box Model

CSS MarginCSS PaddingCSS BorderCSS OutlineCSS Width and Height

CSS Layout

Normal FlowCSS DisplayCSS PositionAnchor PositioningCSS FloatCSS OverflowCSS Z-indexIntrinsic SizingAspect Ratio & Object FitMulti-column Layout

CSS Flexbox

Flex ContainerFlex DirectionJustify ContentAlign ItemsFlex WrapFlex Item Sizing

CSS Grid

CSS Grid ContainerCSS Grid ColumnsCSS Grid RowsCSS Grid GapCSS Grid Layout ExampleGrid PlacementGrid AreasCSS Subgrid

CSS Lists, Tables & Forms

CSS ListsCSS TablesCSS Form StylingCSS Input Fields

CSS Effects

CSS ShadowsCSS GradientsCSS FiltersCSS OpacityClipping & MaskingBlending & BackdropScroll Snap

CSS Animations & Transitions

CSS TransformCSS 2D TransformCSS 3D TransformCSS TransitionsEntry & Exit TransitionsCSS AnimationsScroll AnimationsView TransitionsMotion Paths

CSS Responsive Design

CSS Media QueriesResponsive LayoutMobile First DesignContainer QueriesPreference Media QueriesFeature Queries

Modern CSS Authoring

Cascade LayersNesting & ScopeLogical PropertiesGenerated Content

CSS Accessibility

Accessible CSSCSS ThemingModern Form StylingCSS User Interface

CSS Output & Performance

Print StylesCSS PerformanceCSS ArchitectureDebugging CSS

CSS Reference

CSS At-rulesCSS FunctionsCSS Tutorial PDF

CSS Projects

Responsive CSS Project
  1. Home
  2. /
  3. Tutorials
  4. /
  5. CSS Tutorial
  6. /
  7. CSS 3D Transform

CSS Animations & Transitions

CSS 3D Transform

CSS 3D Transform allows you to transform elements in a three-dimensional space using the X, Y, and Z axes.

Unlike 2D transforms, which work only horizontally and vertically, 3D transforms add depth, enabling realistic visual effects such as: The supporting concepts are explained in CSS Transform and CSS Animations.

  • Card flips
  • 3D rotations
  • Cube effects
  • Interactive UI components
  • Modern animations

CSS 3D transformations are widely used in advanced web interfaces and interactive designs.

Syntax

3D Transform Syntax

css

selector {
    transform: function(value);
}

3D Transform Example

css

.box {
    transform: rotateY(45deg);
}

Rotates the element 45 degrees along the Y-axis.

Attributes

FunctionDescriptionExample
rotateX()Rotates around X-axisrotateX(45deg)
rotateY()Rotates around Y-axisrotateY(45deg)
rotateZ()Rotates around Z-axisrotateZ(45deg)
translateZ()Moves element along Z-axistranslateZ(50px)
perspectiveCreates depth effectperspective: 800px;

Example

CSS 3D Transform Complete Example

html

<!DOCTYPE html>
<html>
<head>
    <title>CSS 3D Transform Example</title>
    <style>
        .container {
            perspective: 800px;
        }
        .box {
            width: 150px;
            height: 150px;
            background-color: lightblue;
            margin: 50px;
            transform: rotateY(45deg);
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="box"></div>
    </div>
</body>
</html>

Browser Support

Feature
Chrome
Edge
Firefox
Safari
transform-style3612169

Versions show the first stable desktop release with unprefixed support. Data source: MDN Browser Compatibility Data 8.0.8.

Notes

Rotate Along X-Axis

Rotate Along X-Axis

css

transform: rotateX(45deg);

Tilts the element forward or backward.

Rotate Along Y-Axis

Rotate Along Y-Axis

css

transform: rotateY(45deg);

Rotates the element left or right.

Rotate Along Z-Axis

Rotate Along Z-Axis

css

transform: rotateZ(45deg);

Similar to normal 2D rotation.

Move Along Z-Axis

Move Along Z-Axis

css

transform: translateZ(100px);

Moves the element closer to the viewer.

Add Perspective

Add Perspective

css

.container {
    perspective: 1000px;
}

Creates a realistic depth effect.

Understanding the Axes

3D Axes Overview

css

          Y
          up
          |
          |
          |
          +---------> X
         /
        /
       Z

X-axis -> Left <-> Right rotation
Y-axis -> Side-to-side rotation
Z-axis -> Depth movement

Common 3D Transform Functions

FunctionEffect
rotateX()Rotate forward/backward
rotateY()Rotate left/right
rotateZ()Rotate in place
translateZ()Move closer/farther
perspectiveAdd depth

Conclusion

CSS 3D Transform extends the capabilities of standard transformations by introducing depth and three-dimensional movement. Using properties such as rotateX(), rotateY(), translateZ(), and perspective, you can create immersive and visually engaging effects that enhance modern web interfaces.

PreviousCSS 2D TransformNextCSS Transitions