Add a snippet with the percentage syntax.

This commit is contained in:
Rodrigo Girão Serrão
2022-12-19 12:01:59 +00:00
parent 9de55aa1ce
commit dc127dad86
2 changed files with 28 additions and 0 deletions

View File

@@ -1 +1,27 @@
# Percentage
## Syntax
--8<-- "docs/styles/snippets/percentage_syntax.md"
!!! warning
Not to be confused with the [fractional](./fractional.md) unit nor with the [scalar](./scalar.md) unit.
## Examples
```css
Widget {
background: red 70%;
}
```
```py
widget.styles.background = "red 70%"
```
## Used by
- [`background`](../background.md)
- [`color`](../color.md)
- [`tint`](../tint.md)

View File

@@ -0,0 +1,2 @@
A percentage is a number followed by the percent sign.
The number doesn't have to be an integer and values are clamped between 0% and 100%.