-
Notifications
You must be signed in to change notification settings - Fork 22.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sqrt()
- New CSS functional notation (#21154)
* `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
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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("<number>")}} greater than or equal to 0. | ||
|
||
### Return value | ||
|
||
Returns a {{cssxref("<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 | ||
|
||
{{CSSSyntax}} | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
|
||
- {{CSSxRef("pow")}} | ||
- {{CSSxRef("hypot")}} | ||
- {{CSSxRef("log")}} | ||
- {{CSSxRef("exp")}} |