Skip to content

translate

Utilities for translating an element along X, Y, or Z axes using spacing units, percentages, or fractions.

ISS preview
Iced + ISS preview demonstrating translate
ISS preview for translate
use iced::widget::container;
use iss::{tw, TwExt};
let badge = container(label).tw(tw!("absolute top-0 right-0 translate-x-1/2 -translate-y-1/2 px-2 py-0.5 bg-rose-500 rounded-full"));
Tailwind Class CSS Property / Effect iss::typed Builder
translate-x-<n> / translate-y-<n> translate: <x> <y>; .translate_x(4) / .translate_y(-2)
translate-x-1/2 / -translate-x-1/2 / full Percentage/fractional shifts; .translate_x_frac(-1, 2)
translate-z-<n> 3D Z-axis translation; .translate_z(4)
translate-none translate: none; .translate_none()
translate-x-[18px] Arbitrary pixel shift; .translate_x_px(18)
  • Fractional offsets like -translate-x-1/2 resolve against the element’s own measured size.

top / right / bottom / left · rotate · scale