1. Transforms
  2. transform-origin

Transforms

transform-origin

Utilities for specifying the origin for an element's transformations.

ClassStyles
origin-center
transform-origin: center;
origin-top
transform-origin: top;
origin-top-right
transform-origin: top right;
origin-right
transform-origin: right;
origin-bottom-right
transform-origin: bottom right;
origin-bottom
transform-origin: bottom;
origin-bottom-left
transform-origin: bottom left;
origin-left
transform-origin: left;
origin-top-left
transform-origin: top left;
origin-(<custom-property>)
transform-origin: var(<custom-property>);
origin-[<value>]
transform-origin: <value>;

Examples

Basic example

Use utilities like origin-top and origin-bottom-left to set an element's transform origin:

origin-center

origin-top-left

origin-bottom

<img class="origin-center rotate-45 ..." src="/img/mountains.jpg" /><img class="origin-top-left rotate-12 ..." src="/img/mountains.jpg" /><img class="origin-bottom -rotate-12 ..." src="/img/mountains.jpg" />

Using a custom value

Use the origin-[<value>] syntax to set the transform origin based on a completely custom value:

<img class="origin-[33%_75%] ..." src="/img/mountains.jpg" />

For CSS variables, you can also use the origin-(<custom-property>) syntax:

<img class="origin-(--my-transform-origin) ..." src="/img/mountains.jpg" />

This is just a shorthand for origin-[var(<custom-property>)] that adds the var() function for you automatically.

Responsive design

Prefix a transform-origin utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:

<img class="origin-center md:origin-top ..." src="/img/mountains.jpg" />

Learn more about using variants in the variants documentation.

Copyright © 2025 Tailwind Labs Inc.·Trademark Policy