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 Transform

CSS Animations & Transitions

CSS Transform

The CSS Transform property is used to change the position, size, rotation, or shape of an element without affecting the normal document layout.

Transforms allow you to:

  • Move elements
  • Rotate elements
  • Resize elements
  • Skew elements
  • Create interactive UI effects

The transform property is widely used in modern web design, animations, hover effects, and user interfaces. The supporting concepts are explained in CSS 2D Transform and CSS 3D Transform.

Syntax

Transform Syntax

css

selector {
    transform: function(value);
}

Transform Example

css

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

Rotates the element by 45 degrees.

Attributes

FunctionDescriptionExample
translate()Moves an elementtranslate(50px, 20px)
rotate()Rotates an elementrotate(45deg)
scale()Resizes an elementscale(1.5)
skew()Tilts an elementskew(20deg)
matrix()Combines multiple transformsmatrix(...)

Transforms do not reflow surrounding content

A transformed element is painted in a different position or shape, but its original layout box still occupies space in normal flow. Transforms can create a stacking context and change the containing block used by positioned descendants. Use them for visual movement and compositing-friendly effects, not to repair document layout that should be handled by Grid, Flexbox, spacing, or positioning.

Example

CSS Transform Complete Example

html

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

Browser Support

Feature
Chrome
Edge
Firefox
Safari
transform3612169

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

Notes

Multiple transforms can be combined.

Move an Element

Translate Example

css

transform: translate(50px, 20px);

Moves the element 50px right and 20px down.

Rotate an Element

Rotate Example

css

transform: rotate(45deg);

Rotates the element by 45 degrees.

Scale an Element

Scale Example

css

transform: scale(1.5);

Makes the element 1.5 times larger.

Skew an Element

Skew Example

css

transform: skew(20deg);

Tilts the element.

Multiple Transformations

Multiple Transformations

css

transform:
    translate(20px, 10px)
    rotate(15deg)
    scale(1.2);

Applies multiple effects simultaneously.

Common Transform Functions

FunctionEffect
translate()Move
rotate()Rotate
scale()Resize
skew()Tilt
matrix()Advanced transformation

Conclusion

The CSS Transform property provides powerful ways to manipulate elements visually without changing the document structure. By using translate, rotate, scale, and skew, you can create engaging layouts, hover effects, and modern user interfaces.

PreviousScroll SnapNextCSS 2D Transform