I know you can write a power function in Sass with a loop. Is there one specifially in CSS? Or a way to write one?
The 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()
And it's now under the CSS Values and Units Module Level 4 Specification:
The exponential functions
pow()
,sqrt()
,hypot()
,log()
, andexp()
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>
.
We only need to wait for their support by the browsers