sqrt()
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The sqrt()
CSS function is an exponential function that returns the square root of a number.
The function pow(x, 0.5)
is equivalent to sqrt(x)
.
Syntax
/* A <number> value */
width: calc(100px * sqrt(9)); /* 300px */
width: calc(100px * sqrt(25)); /* 500px */
width: calc(100px * sqrt(100)); /* 1000px */
Parameters
The sqrt(x)
function accepts only one value as its parameter.
x
-
A calculation which resolves to a
<number>
greater than or equal to 0.
Return value
Returns a <number>
which is the square root of x
.
- if
x
is+∞
, the result is+∞
. - If
x
is0⁻
, the result is0⁻
. - If
x
is less than0
, the result isNaN
.
Formal syntax
Specifications
Specification |
---|
CSS Values and Units Module Level 4 # exponent-funcs |
Browser compatibility
BCD tables only load in the browser