<angle> CSS type

Baseline
Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

The <angle> CSS data type represents an angle value expressed in degrees, gradians, radians, or turns.

Try it

transform: rotate(45deg);
transform: rotate(3.1416rad);
transform: rotate(-50grad);
transform: rotate(1.75turn);
<section class="default-example" id="default-example">
  <div class="transition-all" id="example-element">
    This box can rotate to different angles.
  </div>
</section>
#example-element {
  background-color: #0118f3;
  padding: 0.75em;
  width: 180px;
  height: 120px;
  color: white;
}

Associated properties, functions, and at-rule descriptors

This data type is accepted in values for the following CSS properties:

This data type is also accepted as a parameter for the following CSS functions:

This data type is also accepted in the values of the following CSS at-rule descriptor:

Syntax

Angle values are <dimension> values denoted by the following unit types:

deg

Represents an angle in degrees. One full circle is 360deg.

grad

Represents an angle in gradians. One full circle is 400grad.

rad

Represents an angle in radians. One full circle is 2π radians, which is approximately 6.2832rad, with 1rad being 180/π degrees.

turn

Represents an angle in a number of turns. One full circle is 1turn.

Description

The <angle> data type consists of a <number> followed by one of the units listed below. As with all dimensions, there is no space between the unit literal and the number.

css
/* Degrees */
0deg
14.23deg
360deg

/* Gradians */
0grad
-100grad
38.8grad
400grad

/* Radians */
0rad
1.0708rad
6.2832rad

/* Turns */
0turn
0.25turn
-1.2turn
1turn

While some legacy uses accept a unitless 0, you should always include a unit for zero values, such as: 0deg, 0grad, 0rad, or 0turn.

Optionally, the angle may be preceded by a single + or - sign. Positive numbers represent clockwise angles, while negative numbers represent counterclockwise angles. Angles can be represented by various generally equivalent values. For example, 90deg equals -270deg, and 1turn equals 4turn. However, if animating or transitioning <angle> values, generally equivalent values can create very different effects. For example, no transition occurs when rotating an element between two 90deg values, but an animation between the generally equivalent 90deg and -270deg will be a full rotation.

Examples

Setting a clockwise right angle

A diagram showing a clockwise 90-degree rotation along a circle by moving from the topmost point to the rightmost point. 90deg = 100grad = 0.25turn ≈ 1.5708rad

Setting a flat angle

A diagram showing a clockwise 180-degree rotation along a circle by moving from the topmost point to the bottommost point. 180deg = 200grad = 0.5turn ≈ 3.1416rad

Setting a counterclockwise right angle

A diagram showing a counterclockwise 90-degree rotation along a circle by moving from the topmost point to the leftmost point. -90deg = -100grad = -0.25turn ≈ -1.5708rad

Setting a null angle

A diagram showing a 0-degree rotation. There is no movement. 0deg = 0grad = 0turn = 0rad

Specifications

Specification
CSS Values and Units Module Level 4
# angles

Browser compatibility

See also