
Possible values for the z-axis are: Defines, as a fixed length, an offset of the transform origin from the top left corner of the element's bounding box. bottom Places the transformed element at the bottom of the element's bounding box. For example, transform-origin: 30px top Places the transformed element at the top of the element's bounding box. For example, transform-origin: 30% Defines, as a fixed length, an offset of the transform origin from the top left corner of the element's bounding box. Possible values for the y-axis are: Defines, as a percentage value, an offset of the transform origin from the top left corner of the element's bounding box. right Places the transformed element at the right of the element's bounding box.

center Places the transformed element at the center of the element's bounding box. For example, transform-origin: 30px left Places the transformed element at the left of the element's bounding box. Possible values for the x-axis are: Defines, as a percentage value, an offset of the transform origin from the top left corner of the element's bounding box. Lastly, using the rotateZ value allows an element to be rotated around the z axis.Īs with the general rotate value before, positive values will rotate the element around its dedicated axis clockwise, while negative values will rotate the element counterclockwise.Explanation of the possible values: x-axis Using the rotateY value allows you to rotate an element around the y axis, as if it were being bent in half vertically.

Using the rotateX value allows you to rotate an element around the x axis, as if it were being bent in half horizontally. To do so, we use three new transform values, including rotateX, rotateY, and rotateZ. With three-dimensional transforms we can rotate an element around any axes.
Transform origin how to#
So far we’ve discussed how to rotate an object either clockwise or counterclockwise on a flat plane. Using three-dimensional transforms we can change elements on the z axis, giving us control of depth as well as length and width. Working with two-dimensional transforms we are able to alter elements on the horizontal and vertical axes, however there is another axis along which we can transform elements.

See the Pen Perspective Origin by Shay Howe ( on CodePen. The value specifies the transform type followed by a specific amount inside parentheses. The actual syntax for the transform property is quite simple, including the transform property followed by the value.
Transform origin download#
For the best support vendor prefixes are encouraged, however you may need to download the nightly version of Chrome to see all of these transforms in action. Generally speaking, browser support for the transform property isn’t great, but it is getting better every day. Within this lesson we’ll take a look at both two-dimensional and three-dimensional transforms. Each of these come with their own individual properties and values. The transform property comes in two different settings, two-dimensional and three-dimensional. All of these new techniques are made possible by the transform property. Now general layout techniques can be revisited with alternative ways to size, position, and change elements.

With CSS3 came new ways to position and alter elements.
