Skip to content

Commit

Permalink
sqrt() - New CSS functional notation (#21154)
Browse files Browse the repository at this point in the history
* `sqrt()` - New CSS functional notation

* Add browser-compat

* Markdown lint

* Update files/en-us/web/css/sqrt/index.md

Co-authored-by: wbamberg <will@bootbonnet.ca>

* Update index.md

Co-authored-by: wbamberg <will@bootbonnet.ca>
  • Loading branch information
ramiy and wbamberg committed Oct 6, 2022
1 parent c05fc2b commit 16996a7
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions files/en-us/web/css/sqrt/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
title: sqrt()
slug: Web/CSS/sqrt
page-type: css-function
tags:
- CSS
- CSS Function
- Function
- Layout
- Reference
- Web
- sqrt
- Experimental
browser-compat: css.types.sqrt
---

{{CSSRef}}{{SeeCompatTable}}

The **`sqrt()`** [CSS](/en-US/docs/Web/CSS) [function](/en-US/docs/Web/CSS/CSS_Functions) is an exponential function that returns the [square root](https://en.wikipedia.org/wiki/Square_root) of a number.

The function `pow(x, 0.5)` is equivalent to `sqrt(x)`.

## Syntax

```css
/* 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 {{cssxref("&lt;number&gt;")}} greater than or equal to 0.

### Return value

Returns a {{cssxref("&lt;number&gt;")}} 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

{{CSSSyntax}}

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{CSSxRef("pow")}}
- {{CSSxRef("hypot")}}
- {{CSSxRef("log")}}
- {{CSSxRef("exp")}}

0 comments on commit 16996a7

Please sign in to comment.