CSS <angle-percentage> Data Type
Description
The CSS transform
property and the border-radius
property.
When an
For example, the following CSS code will set the element's border radius to be equal to 10% of its container element's width:
.element {
border-radius: 10%;
}
If the element's container element has a width of 500 pixels, then the element's border radius will be set to 50 pixels.
Another example is the following CSS code, which will rotate the element by 10% of its container element's height:
.element {
transform: rotate(10%);
}
If the element's container element has a height of 200 pixels, then the element will be rotated by 20 degrees.
The
.element {
width: calc(50% - 10%);
}
This is useful for creating responsive layouts that adapt to different screen sizes.
Overall, the
Syntax
<angle-percentage> = <angle> | <percentage>
Values
- <angle>Refer to <angle> for possible values
- <percentage>Refer to <percentage> for possible values
Example
/* angle */
clip-path: polygon(0 50%, 50% 100%, 100% 50%);
/* percentage */
clip-path: polygon(0 50%, 50% 100%, 100% 50%);
/* angle-percentage */
clip-path: polygon(0 calc(50% + 10deg), 50% 100%, 100% calc(50% - 10deg));
Browser Support
The following table will show you the current browser support for the CSS angle-percentage
data type.
Desktop | |||||
12 | 2 | 3.6 | 15 | 4 |
Tablets / Mobile | |||||
18 | 4 | 14 | 3.2 | 1 | 2 |
Last updated by CSSPortal on: 7th October 2023