Javatpoint Logo
Javatpoint Logo

CSS Transform Rotate

The cascading style sheet (CSS) transform rotate helps to operate and rotate the image, block of the data, and other animated containers. The rotate property is part of the transform property. The transform property works many visual effects for the image or container. The rotate property is used for rotating the element around the centre or itself.

The transform property contains the rotate property with the angle. We can use angles with clockwise and anti-clockwise directions. Sometimes, the transform property uses horizontal and vertical rotation properties with the angle.

Basic CSS Transform Rotates

The basic CSS transform "rotate" property rotates the container or image in a clockwise or anticlockwise direction.

Syntax

The following syntaxes use the transform rotate property in the CSS with different rotate properties.

Description

  • The angle is a required parameter for the transform-rotate property.
  • We can use positive and negative values in the angle parameter.

Examples

The following examples show the image or data of the container rotation in different directions.

Examples 1:

The following example shows the container rotation in positive directions.

Output

The output shows the rotation of the container.

CSS Transform Rotate

Examples 2:

The following example shows the container rotation in negative directions.

Output

The output shows the rotation of the container.

CSS Transform Rotate

Examples 3:

The following example shows the container rotation with a hover effect.

Output

The output shows the rotation of the container.

CSS Transform Rotate

CSS 3D Transform Rotate

The basic CSS transform rotates property and the container or image in the required direction for the 3D rotation.

Syntax

The following syntax uses the transform rotates property for 3d rotation.

Description

  • The x,y, and z are the axes of the image or container. The value must be in the number format.
  • The angle shows a negative or positive value with the axis.
  • There are three axis numbers required with the angle.
  • The transform with the rotate3d() property is required in CSS for 3d rotation.

Examples

The following examples show the direction with the different x, y, and z axes.

Examples 1:

The following example shows the container for 3d rotation in positive directions. We can set a positive or negative axis with a positive angle.

Output

The output shows the 3d rotation of the container.

CSS Transform Rotate

Examples 2:

The following example shows the container for 3d rotation in negative directions. We can set a positive or negative axis with a negative angle.

Output

The output shows the 3d rotation of the container.

CSS Transform Rotate

Examples 3:

The following example shows the container's 3D rotation with a hover effect.

Output

The output shows the 3D rotation of the container.

CSS Transform Rotate

Basic CSS Transform Rotates the Axis

The CSS transform rotates the property, container, or image with the x, y, and z-axis.

Syntax

The following syntax uses the transform rotates property for 3d rotation with the axis.

Description

  • The AXIS means the X, Y, or Z axis of the image or container of the information.
  • We can set the angle with the negative or positive value, but it does not affect the x and y axis.
  • The transform with the rotateX|Y|Z() property is required in CSS.

Examples

The rotate property uses a particular axis to rotate clockwise or anticlockwise. The direction does not affect the rotateAXIS() method.

Examples 1:

The following example shows the information tag for 3d rotation in the required directions. We can set the x-axis with the required angle.

Output

The output shows the rotation of the container on the x-axis.

CSS Transform Rotate

Examples 2:

The following example shows the information tag for 3d rotation in the required directions. We can set the Y-axis with the required angle.

Output

The output shows the rotation of the container in the Y-axis.

CSS Transform Rotate

Examples 3:

The following example shows the information tag for 3d rotation in the required directions. We can set the z-axis with the required angle.

Output

The output shows the rotation of the container in the z-axis.

CSS Transform Rotate

Examples 4:

The following example shows the container 3d rotation with hover effect. We can hover rotation with the x, y, and z-axis.

Output

The output shows the 3d rotation of the container with the axis.

CSS Transform Rotate

Conclusion

CSS transform rotate helps to design and place tags to make attractive functions with the angle. It helps to show design and shapes at the required angle with the rotate property.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA