Add CSS type number.

This commit is contained in:
Rodrigo Girão Serrão
2022-12-21 19:41:19 +00:00
parent bf2000f9b5
commit cf6cd06a33
2 changed files with 32 additions and 0 deletions

31
docs/css_types/number.md Normal file
View File

@@ -0,0 +1,31 @@
# <number>
The `<number>` CSS type represents a real number, which can be an integer or a number with a decimal part (akin to a `float` in Python).
## Syntax
--8<-- "docs/snippets/type_syntax/number.md"
## Examples
### CSS
```sass
* {
css-rule: 6 /* Integers are numbers */
css-rule: -13 /* Numbers can be negative */
css-rule: 4.75 /* Numbers can have a decimal part */
css-rule: -73.73
}
```
### Python
In Python, a rule that expects a CSS type `<number>` will accept an `int` or a `float`:
```py
number = 6 # ints are numbers
number = -13 # ints can be negative
number = 4.75 # floats are numbers
number = -73.73 # negative floats too
```

View File

@@ -0,0 +1 @@
A [`<number>`](/css_types/number) is an [`<integer>`](/css_types/integer), optionally followed by the decimal point `.` and a decimal part composed of one or more digits.