mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
more docs
This commit is contained in:
37
docs/styles/width.md
Normal file
37
docs/styles/width.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# Width
|
||||
|
||||
The `width` property sets a widget's width. By default, it sets the width of the content area, but if `box-sizing` is set to `border-box` it sets the width of the border area.
|
||||
|
||||
## Example
|
||||
|
||||
=== "width.py"
|
||||
|
||||
```python
|
||||
--8<-- "docs/examples/styles/width.py"
|
||||
```
|
||||
|
||||
=== "Output"
|
||||
|
||||
```{.textual path="docs/examples/styles/width.py"}
|
||||
```
|
||||
|
||||
## CSS
|
||||
|
||||
```sass
|
||||
/* Explicit cell width */
|
||||
width: 10;
|
||||
|
||||
/* Percentage width */
|
||||
width: 50%;
|
||||
|
||||
/* Automatic width */
|
||||
width: auto
|
||||
```
|
||||
|
||||
## Python
|
||||
|
||||
```python
|
||||
self.styles.width = 10
|
||||
self.styles.width = "50%
|
||||
self.styles.width = "auto"
|
||||
```
|
||||
Reference in New Issue
Block a user