diff --git a/docs/css_types/number.md b/docs/css_types/number.md new file mode 100644 index 000000000..0e1cc3e8f --- /dev/null +++ b/docs/css_types/number.md @@ -0,0 +1,31 @@ +# <number> + +The `` 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 `` 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 +``` diff --git a/docs/snippets/type_syntax/number.md b/docs/snippets/type_syntax/number.md new file mode 100644 index 000000000..aaf0aac07 --- /dev/null +++ b/docs/snippets/type_syntax/number.md @@ -0,0 +1 @@ +A [``](/css_types/number) is an [``](/css_types/integer), optionally followed by the decimal point `.` and a decimal part composed of one or more digits.