Css 简明教程

CSS - 2D Transforms

CSS 提供了一组可让你在二维空间中变换和调整元素的属性。允许你变换元素的属性包括平移、旋转、缩放、倾斜等。

CSS provides a set of properties that allow you to transform and adjust the elements in the two-dimensional space. The properties that let you transform the elements include translations, rotations, scaling, skewing, etc.

下表列出了所有用于在二维空间中变换元素的各种属性:

The following table lists all the various properties that are used transform the elements in the two-dimensional space:

Property

Description

rotate

Rotates an element by a specified angle.

scale

Scales by an element by a specified factor.

transform

Transforms an element, such as rotates, scales, skews or translates.

transform-box

Defines the layout box for transformation.

transform-origin

Sets the origin for the transformation of an element.

translate

Moves an element from its current position.

matrix()

Defines the transformation of an element based on six matrix values.

rotate()

Rotates an element around a fixed point in two-dimensional space.

rotateX()

Rotates an element around the horizontal axis in two-dimensional space.

rotateY()

Rotates an element around the vertical axis in two-dimensional space.

scale()

Scales an element up or down in two-dimensional space.

scaleX()

Scales an element up or down horizontally.

scaleY()

Scales an element up or down vertically.

skew()

Skews an element in two-dimensional space.

skewX()

Skews an element in the horizontal direction.

skewY()

Skews an element in the vertical direction.

translate()

Translates an element in two-dimensional space.

translateX()

Translates an element horizontally.

translateY()

Translates an element vertically.