CSS sqrt() function

Definition and usage

CSS's sqrt() The function returns the square root of a number.

example

in calc() function used in sqrt() To set the width and height of three <div> elements:

div.a {
  width: calc(50px * sqrt(16)); /* 200px */
  height: calc(50px * sqrt(9)); /* 150px */
  background-color: salmon;
  margin-bottom: 25px;
}
div.b {
  width: calc(20px * sqrt(16)); /* 80px */
  height: calc(20px * sqrt(9)); /* 60px */
  background-color: green;
  margin-bottom: 25px;
}
div.c {
  width: calc(60px * sqrt(16)); /* 240px */
  height: calc(60px * sqrt(9)); /* 180px */
  background-color: maroon;
}

Try it yourself

CSS syntax

sqrt(x)
Value Description
x Required. A number greater than or equal to 0.

Technical details

Version: CSS4

Browser support

The numbers in the table represent the first browser version to fully support this function.

Chrome Edge Firefox Safari Opera
120 120 118 15.4 106

Related pages

Παραδείγματα:CSS acos() function

Παραδείγματα:CSS asin() function

Παραδείγματα:CSS atan() function

Παραδείγματα:CSS atan2() function

Παραδείγματα:CSS calc() function

Παραδείγματα:CSS cos() function

Παραδείγματα:CSS exp() function

Παραδείγματα:CSS hypot() function

Παραδείγματα:CSS log() function

Παραδείγματα:Συνάρτηση mod CSS mod()

Παραδείγματα:Συνάρτηση sin CSS sin()

Παραδείγματα:Συνάρτηση tan CSS tan()