Transform

Transform

Can I use ?Can I use ?
classproperties
transform:functiontransform: function
translate(x,y)transform: translate(x, y)
translate3d(x,y,z)transform: translate3d(x, y, z)
translateX(x)transform: translateX(x)
translateY(y)transform: translateY(y)
translateZ(z)transform: translateZ(z)
scale(both)transform: scale(both)
scale(x,y)transform: scale(x, y)
scale3d(x,y,z)transform: scale3d(x, y, z)
scaleX(x)transform: scaleX(x)
scaleY(y)transform: scaleY(y)
scaleZ(z)transform: scaleZ(z)
skew(x,y)transform: skew(x, y)
skewX(x)transform: skewX(x)
skewY(y)transform: skewY(y)
rotate(angle)transform: rotate(angle)
rotate3d(x,y,z,angle)transform: rotate3d(x, y, z, angle)
rotateX(value)transform: rotateX(value)
rotateY(value)transform: rotateY(value)
rotateZ(value)transform: rotateZ(value)
perspective(value)transform: perspective(value)
matrix(a,b,c,d,x,y)transform: matrix(a, b, c, d, x, y)
matrix3d(a1,b1,c1,d1,a2,b2,c2,d2,a3,b3,c3,d3,a4,b4,c4,d4)transform: matrix3d(a1, b1, c1, d1, a2, b2, c2, d2, a3, b3, c3, d3, a4, b4, c4, d4)

Overview

The transform CSS property lets you rotate, scale, skew, or translate an element. It modifies the coordinate space of the CSS visual formatting model.

Basic usage

Translate

Scale

Skew

Rotate

Perspective

<div class="">
<div class="
    transform-style:preserve-3d 
    transform:perspective(25rem)|rotateX(-25deg)|rotateY(-15deg) ...">
    <div class="transform:translateZ(50px)">
        <img class="opacity:.5 bg:gray-50|url('/images/wallpaper.jpg')|no-repeat|top|left/cover aspect:1/1"/>
    </div>
    <div class="transform:rotateY(180deg)|translateZ(50px)">
        <img/>
    </div>
    <div class="transform:rotateY(90deg)|translateZ(50px)">
        <img/>
    </div>
    <div class="transform:rotateY(-90deg)|translateZ(50px)">
        <img/>
    </div>
    <div class="transform:rotateX(90deg)|translateZ(50px)">
        <img/>
    </div>
    <div class="transform:rotateX(-90deg)|translateZ(50px)">
        <img/>
    </div>
</div>

Matrix

matrix(1,0,0,1,0,0)scale(1,1)
wallpaperwallpaper
translateX: 0
translateY: 0
scaleX: 1
scaleY: 1
skewX: 0
skewX: 0

Applying with functions

<div class="transform:$(value)">...</div>

Master supports native CSS variables and functions, just add var(--key) or use shorthand$(key) for variables.

You can also use calc(expression), env(expression) and other CSS functions if the property supports it.

To learn more, see the Functions documentation.

Conditionally apply

States and selectors

<div class="transform:scale(1):hover">...</div>

Master supports all native CSS selectors, just add :hover, :disabled, chaining, combinators and other CSS selectors as usual.

To learn more, see the Selectors documentation.

Responsive breakpoints

<div class="transform:scale(1)@sm">...</div>

Responsive breakpoints can be applied to all styles. Some available breakpoints are 3xs, 2xs, xs, sm,md, lg, xl, 2xl, 3xl, 4xl. Arbitrary breakpoints can be specified through comparison operators >, >=, <, <=.

To learn more, see the Breakpoints documentation.

<div class="transform:scale(1)@print">...</div>

Master supports media types like print, screen, speech, all, and other media queries.

To learn more, see the Media Queries documentation.

Dark mode and color schemes

<div class="transform:scale(1)@dark">...</div>

Master uses the selector html.dark to support color schemes. Now, you can easily fine-tune your style for the color schemes.

To learn more, see the Color Schemes documentation.


© Aoyue Design LLC.
Issue on this page
Edited byAronLola