Skip to content

Transforms

Transform Origin

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

Quick reference

ClassDescription
origin-centertransform-origin: center
origin-toptransform-origin: top
origin-top-righttransform-origin: top right
origin-righttransform-origin: right
origin-bottom-righttransform-origin: bottom right
origin-bottomtransform-origin: bottom
origin-bottom-lefttransform-origin: bottom left
origin-lefttransform-origin: left
origin-top-lefttransform-origin: top left

Basic usage

Changing the transform origin

Specify an element’s transform origin using the origin-{keyword} utilities.

origin-center

Ai generated image of 1920s scientists working on a warp driveAi generated image of 1920s scientists working on a warp drive

origin-top-left

Ai generated image of 1920s scientists working on a warp driveAi generated image of 1920s scientists working on a warp drive

origin-bottom

Ai generated image of 1920s scientists working on a warp driveAi generated image of 1920s scientists working on a warp drive
html
<img class="rotate-30 origin-center ..." />
<img class="rotate-30 origin-top-left ..." />
<img class="rotate-30 origin-bottom ..." />

Applying conditionally

Hover, focus, and other states

Warp lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:origin-top to only apply the origin-top utility on hover.

html
<div class="origin-center hover:origin-top"></div>

Breakpoints and media queries

You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:origin-top to apply the origin-top utility at only medium screen sizes and above.

html
<div class="origin-center md:origin-top"></div>

Released under the Apache 2.0 License.