Transform

Transform utilities move, scale, rotate, center, and adjust the visual origin of elements without writing custom CSS. They are ideal for hover states, floating cards, dropdown animations, centered overlays, decorative badges, and polished interaction details.

FrontAlign uses a composable transform system powered by CSS variables. Multiple transform utilities can work together through the transform utility.

All transform utilities are pure CSS and do not require the FrontAlign runtime.


Quick reference

GroupClassesEffectCommon use
Transform composertransformtransform: translate3d(...) scale(...) rotate(...);Combine scale, translate, and rotate utilities.
Centering

translate-center, translate-x-center, translate-y-center, absolute-center

translate(...) / absolute centeringModals, loaders, hero content, floating controls.
Scale

scale-0, scale-75, scale-90, scale-95, scale-100, scale-105, scale-110, scale-125

scale(...)Hover lifts, pressed states, cards, icons, badges.
Translate

translate-x-*, -translate-x-*, translate-y-*, -translate-y-*

translate3d(...)Floating cards, offsets, micro-interactions.
Rotation

rotate-*, -rotate-*

rotate(...)Icons, arrows, badges, decorative UI.
Origin

origin-center, origin-top, origin-right, origin-bottom, origin-left

transform-origin: ...;Dropdowns, popovers, menus, directional animations.

Usage

Use transform when you want multiple transform utilities to compose cleanly.

<div class="transform scale-105 rotate-3">
  Interactive Card
</div>

How transform works

Transform-related utilities set internal CSS variables. The transform class applies those variables to the final transform property.

<div class="transform scale-110 translate-y-2">
  Content
</div>
transform:
  translate3d(
    var(--fa-translate-x, 0),
    var(--fa-translate-y, 0),
    0
  )
  scale(var(--fa-scale, 1))
  rotate(var(--fa-rotate, 0));

Centered element

Use translate-center when an element already has positioning and should be centered through translation.

<div class="translate-center">
  Centered Element
</div>

Absolute center

Use absolute-center for perfectly centered overlays, loaders, modal content, empty states, and floating controls.

<div class="absolute-center">
  Modal Content
</div>

Scaled content

Scale utilities resize an element visually while preserving the surrounding document flow.

<div class="transform scale-105">
  Enlarged Content
</div>

Vertical offset

Use translate utilities for subtle movement, hover lifts, and floating card effects.

<div class="transform translate-y-4">
  Floating Card
</div>

Horizontal offset

Horizontal translate utilities are useful for decorative offsets, slide-in details, and controlled UI movement.

<div class="transform translate-x-4">
  Offset Element
</div>

Rotated icon

Rotation utilities work well for icons, arrows, badges, and decorative labels.

<i class="transform rotate-90">
  →
</i>

Centering utilities

ClassBehaviorRecommended use
translate-centerCenters on both axes.Centered overlays, loader wrappers, positioned content.
translate-x-centerCenters horizontally.Tooltips, floating labels, horizontal alignment.
translate-y-centerCenters vertically.Side controls, vertical icons, rail buttons.
absolute-centerAbsolutely centers the element.Modals, loaders, hero content, empty states, floating controls.

Scale

Scale utilities resize elements visually. Use smaller values for professional interfaces and larger values only for decorative or explicit emphasis.

ClassValueRecommended use
scale-00Hidden or collapsed transform state.
scale-750.75Compact decorative elements.
scale-900.90Small entrance or inactive states.
scale-950.95Pressed buttons, dropdown start states.
scale-1001.00Default or reset scale.
scale-1051.05Hover cards, interactive surfaces.
scale-1101.10Icon emphasis and stronger hover states.
scale-1251.25Decorative emphasis and illustrations.

Translate Y

Vertical translate utilities move elements up or down through the transform system.

ClassOffsetDirection
translate-y-1-0.25remUp
translate-y-2-0.5remUp
translate-y-3-0.75remUp
translate-y-4-1remUp
translate-y-8-2remUp
-translate-y-10.25remDown
-translate-y-20.5remDown
-translate-y-30.75remDown
-translate-y-41remDown
-translate-y-82remDown

Translate X

Horizontal translate utilities move elements left or right through the transform system.

ClassOffsetDirection
translate-x-10.25remRight
translate-x-20.5remRight
translate-x-30.75remRight
translate-x-41remRight
translate-x-82remRight
-translate-x-1-0.25remLeft
-translate-x-2-0.5remLeft
-translate-x-3-0.75remLeft
-translate-x-4-1remLeft
-translate-x-8-2remLeft

Rotation

Rotation utilities are useful for icons, badges, decorative UI, disclosure arrows, and playful visual accents.

Subtle rotation

Use subtle rotations for badges, illustrations, stickers, and decorative UI.

ClassRotationRecommended use
rotate-11degVery subtle visual tilt.
rotate-22degSoft decorative emphasis.
rotate-33degBadges and sticker-like UI.
rotate-1212degStronger decorative labels.
-rotate-1-1degVery subtle reverse tilt.
-rotate-2-2degSoft reverse emphasis.
-rotate-3-3degReverse badge tilt.
-rotate-12-12degStrong reverse decorative labels.
<div class="transform rotate-3">
  Badge
</div>

Standard rotation

ClassRotationRecommended use
rotate-4545degDirectional indicators and decorative shapes.
rotate-9090degArrows and rotated icons.
rotate-180180degExpanded/collapsed arrow states.
rotate-270270degDirectional UI and icon orientation.
-rotate-45-45degReverse diagonal rotation.
-rotate-90-90degReverse quarter-turn rotation.

Transform origin

Transform origin controls the point around which scaling and rotation happen. It is especially useful for dropdown menus, popovers, tooltips, and directional animations.

ClassOriginRecommended use
origin-centercenterBalanced scale and rotation.
origin-toptopMenus opening downward.
origin-top-righttop rightRight-aligned dropdown menus.
origin-rightrightSide panels and right-edge motion.
origin-bottom-rightbottom rightMenus or labels anchored from the lower right.
origin-bottombottomElements expanding upward.
origin-bottom-leftbottom leftLeft-aligned upward motion.
origin-leftleftSide navigation and left-edge motion.
origin-top-lefttop leftLeft-aligned dropdown menus.

Menu animation

<div
  class="transform scale-95 origin-top-right"
>
  Dropdown Menu
</div>

Real-world examples

Premium card lift

<div
  class="transform translate-y-2 scale-105"
>
  Feature Card
</div>

Floating action button

<button
  class="transform translate-y-4 shadow-large"
>
  +
</button>

Decorative badge

<div
  class="transform rotate-12"
>
  New
</div>

Centered loader

<div class="absolute-center">
  Loading...
</div>

Rotating icon

<i class="transform rotate-180">
  ↓
</i>

Combining utilities

Scale + translate

<div
  class="transform scale-105 translate-y-2"
>
  Card
</div>

Rotate + scale

<div
  class="transform rotate-3 scale-105"
>
  Sticker
</div>

Translate + rotate

<div
  class="transform translate-x-4 rotate-12"
>
  Decorative Shape
</div>

Choosing the right transform

Use caseRecommended utility
Subtle hover lifttransform + scale-105 + translate-y-2
Perfectly centered overlayabsolute-center
Dropdown opening from a cornerorigin-top-right + scale-95
Rotating arrow indicatortransform + rotate-180
Decorative badgetransform + rotate-12

Usage notes

  • Always use transform when combining transform utilities such as scale, translate, and rotate.
  • Use small scale values for professional interfaces; scale-105 is usually enough for hover emphasis.
  • Reserve large rotations for decorative elements, stickers, badges, and illustrations.
  • Use absolute-center for overlays, modals, loaders, hero content, and empty states.
  • Prefer subtle translations for hover and motion effects so the interface stays calm and premium.
  • Combine transform utilities with shadow, transition-all, hover:, and origin-\* utilities for polished interactive states.

FrontAlign