mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add a snippet with the percentage syntax.
This commit is contained in:
@@ -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)
|
||||
|
||||
2
docs/styles/snippets/percentage_syntax.md
Normal file
2
docs/styles/snippets/percentage_syntax.md
Normal 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%.
|
||||
Reference in New Issue
Block a user