mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
32 lines
433 B
Markdown
32 lines
433 B
Markdown
# Max-width
|
|
|
|
The `max-width` rule sets a maximum width for a widget.
|
|
|
|
## Syntax
|
|
|
|
```
|
|
max-width: <SCALAR>;
|
|
```
|
|
|
|
## CSS
|
|
|
|
```sass
|
|
|
|
/* Set a maximum width of 10 cells */
|
|
max-width: 10;
|
|
|
|
/* Set a maximum width of 25% of the screen width */
|
|
max-width: 25vh;
|
|
```
|
|
|
|
## Python
|
|
|
|
```python
|
|
# Set the maximum width to 10 cells
|
|
widget.styles.max_width = 10
|
|
|
|
# Set the maximum width to 25% of the screen width
|
|
widget.styles.max_width = "25vw"
|
|
|
|
```
|