CSS 数据类型 <angle-percentage> 表示 <angle> 值的分数。
当您使用 <angle-percentage> 作为允许的类型时,指定的百分比可以转换为角度并在 calc() 表达式中使用。
可能的值
- <angle> − 表示以度、百分度、弧度或转弯为单位测量的角度。
- <percentage> − 表示介于 0% 到 100% 之间的百分比值。
语法
<angle-percentage> = <angle> | <percentage>;
CSS <angle-percentage> - 示例
以下示例演示了 transform: rotate(calc(45deg)) 属性的使用,该属性将框旋转 45 度 −
<html>
<head>
<style>
div {
height: 100px;
width: 100px;
border: 2px solid blue;
margin: 20px;
transform: rotate(calc(45deg));
}
</style>
</head>
<body>
<div>
The box rotates by 45deg.
</div>
</body>
</html>