CSS中有幂函数吗?
Is there a power function in CSS?
我知道你可以用循环在 Sass 中写一个幂函数。 CSS 有专门的吗?或者有什么写法?
working group already approved such functions
The CSS Working Group just discussed trig, and agreed to the following:
RESOLVED: Add sin() cos() tan() acos() asin() atan() atan2() hypot() sqrt() pow()
现在在 CSS Values and Units Module Level 4 Specification:
The exponential functions pow()
, sqrt()
, hypot()
, log()
, and `exp()
compute various exponential functions with their arguments.
The pow(A, B)
function contains two comma-separated calculations A and B, both of which must resolve to <number>
s, and returns the result of raising A to the power of B, returning the value as a <number>
.
我们只需要等待浏览器的支持
我知道你可以用循环在 Sass 中写一个幂函数。 CSS 有专门的吗?或者有什么写法?
working group already approved such functions
The CSS Working Group just discussed trig, and agreed to the following:
RESOLVED: Add sin() cos() tan() acos() asin() atan() atan2() hypot() sqrt() pow()
现在在 CSS Values and Units Module Level 4 Specification:
The exponential functions
pow()
,sqrt()
,hypot()
,log()
, and `exp() compute various exponential functions with their arguments.The
pow(A, B)
function contains two comma-separated calculations A and B, both of which must resolve to<number>
s, and returns the result of raising A to the power of B, returning the value as a<number>
.
我们只需要等待浏览器的支持