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 is 0⁻, the result is 0⁻.
  • If x is less than 0, the result is NaN.

Formal syntax

<sqrt()> = 
sqrt( <calc-sum> )

<calc-sum> =
<calc-product> [ [ '+' | '-' ] <calc-product> ]*

<calc-product> =
<calc-value> [ [ '*' | '/' ] <calc-value> ]*

<calc-value> =
<number> |
<dimension> |
<percentage> |
<calc-constant> |
( <calc-sum> )

<calc-constant> =
e |
pi |
infinity |
-infinity |
NaN

Specifications

Specification
CSS Values and Units Module Level 4
# exponent-funcs

Browser compatibility

BCD tables only load in the browser

See also