CSS Portal

CSS <angle-percentage> Data Type

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The <angle-percentage> CSS data type represents a value that can be specified either as an angle or as a percentage. This dual-purpose type is particularly useful in properties where both rotational measurements and relative proportions are meaningful, such as in gradients, rotations, or certain animation settings. By allowing either angles or percentages, <angle-percentage> provides flexibility, enabling designers to choose the unit that best expresses their intended effect.

1. Angles

Angles are absolute measurements. You can use standard CSS units:

  • deg (degrees) – a full circle is 360deg
  • rad (radians) – 2π rad = 360deg
  • grad (gradians) – 400grad = 360deg
  • turn – 1turn = 360deg

Example: Using angles in a conic gradient

div.angle-example {
  width: 200px;
  height: 200px;
  background: conic-gradient(
    red 0deg,   /* start at 0 degrees */
    blue 90deg, /* transition to blue at 90 degrees */
    green 180deg,
    yellow 270deg
  );
}

In this example, the gradient colors are placed at precise absolute rotations around the center of the element.

2. Percentages

Percentages are interpreted as fractions of a full 360° rotation:

  • 0% = 0°
  • 25% = 90°
  • 50% = 180°
  • 75% = 270°
  • 100% = 360°

Percentages are often easier to reason about in animations or gradients because they represent proportional progress rather than a fixed angle.

Example: Using percentages in a conic gradient

div.percentage-example {
  width: 200px;
  height: 200px;
  background: conic-gradient(
    red 0%,    /* start at 0% of full circle */
    blue 25%,  /* 25% of 360° = 90deg */
    green 50%, /* 50% of 360° = 180deg */
    yellow 75%
  );
}

Here, the effect is visually identical to the angle-based example, but the numbers represent proportional coverage rather than exact degrees.

3. Angles vs Percentages in Transformations

<angle-percentage> is also practical for rotations using <code>transform: rotate()</code>:

.box-angle {
  transform: rotate(90deg); /* absolute 90 degrees */
}

.box-percentage {
  transform: rotate(25%); /* 25% of full rotation = 90deg */
}

This makes percentages especially useful in animations or progress indicators, where you might want the rotation to scale dynamically based on some variable input, such as scroll progress.

4. Mixing Angles and Percentages

Some properties allow mixing angles and percentages in the same value list. For example, conic gradients or keyframe animations:

div.mix-example {
  background: conic-gradient(
    red 0deg,
    blue 25%,  /* mix of percentage and angle */
    green 180deg,
    yellow 75%
  );
}

Browsers will automatically convert percentages to angles internally so that the visual result aligns correctly.

5. When to use which

  • Use angles when you need precise, fixed rotations regardless of container size.
  • Use percentages when you want proportional rotations, such as progress-based animations or circular charts.

Example: Animated circular progress bar using percentages

@keyframes spin {
  0% { transform: rotate(0%); }   /* 0% of full circle */
  50% { transform: rotate(50%); } /* half rotation = 180deg */
  100% { transform: rotate(100%); }/* full rotation = 360deg */
}

.circle {
  animation: spin 4s linear infinite;
}

This shows how percentages make dynamic rotation much simpler to manage compared to converting degrees manually.

Syntax

<angle-percentage> = <angle> | <percentage>  

Values

  • <angle>Refer to <angle> for possible values
  • <percentage>Refer to <percentage> for possible values

Example

<div class='container'>
<h1>CSS &lt;angle-percentage&gt; example</h1>
<p class='intro'>This demo uses a conic-gradient where color stops are specified with degrees and percentages.</p>
<div class='wheel' aria-hidden='true'></div>
<pre class='snippet'>background: conic-gradient(from 45deg at 50% 50%, red 0deg 25%, orange 25% 50%, yellow 50% 75%, green 75% 100%);</pre>
</div>
:root {
  --size: 260px;
  --bg: #f6f7fb;
  --card: #ffffff;
  --muted: #6b7280;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 20px;
  padding: 24px;
}

.container {
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(11, 14, 22, 0.08);
  padding: 28px;
  max-width: 850px;
  width: 100%;
  text-align: center;
}

.wheel {
  width: var(--size);
  height: var(--size);
  margin: 18px auto;
  border-radius: 50%;
  background: conic-gradient(from 45deg at 50% 50%,
    red 0deg 25%,
    orange 25% 50%,
    yellow 50% 75%,
    green 75% 100%);
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.06);
}

.snippet {
  background: #0f172a;
  color: #e6eef8;
  padding: 10px 12px;
  border-radius: 8px;
  display: inline-block;
  margin-top: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, 'Roboto Mono', monospace;
  font-size: 13px;
  line-height: 1.4;
  overflow-x: auto;
}

h1 { margin: 0; font-size: 18px; }
.intro { color: var(--muted); margin: 10px 0 0 0; font-size: 13px; }

Browser Support

The following information will show you the current browser support for the CSS angle-percentage data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.

This data type is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 2nd January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!