Add text-align CSS type.

This commit is contained in:
Rodrigo Girão Serrão
2023-01-05 18:33:51 +00:00
parent fa0a4ba3d4
commit d27e13a49a
3 changed files with 52 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
# <text-align>
The `<text-align>` CSS type represents alignments that can be applied to text.
!!! warning
Not to be confused with the [`text-align`](../styles/text_align.md) CSS rule that sets the alignment of text in a widget.
## Syntax
--8<-- "docs/snippets/type_syntax/text_align.md"
## Examples
### CSS
```sass
* {
rule: center;
rule: end;
rule: justify;
rule: left;
rule: right;
rule: start;
}
```
### Python
```py
text_align = "center"
text_align = "end"
text_align = "justify"
text_align = "left"
text_align = "right"
text_align = "start"
```

View File

@@ -0,0 +1,14 @@
A [`<text-align>`](/css_types/text_align) can be any of the following values:
| Value | Alignment type |
|-----------|--------------------------------------|
| `center` | Center alignment. |
| `end` | Alias for `right`. |
| `justify` | Text is justified inside the widget. |
| `left` | Left alignment. |
| `right` | Right alignment. |
| `start` | Alias for `left`. |
!!! tip
The meanings of `start` and `end` will likely change when RTL languages become supported by Textual.

View File

@@ -39,6 +39,7 @@ nav:
- "css_types/overflow.md" - "css_types/overflow.md"
- "css_types/percentage.md" - "css_types/percentage.md"
- "css_types/scalar.md" - "css_types/scalar.md"
- "css_types/text_align.md"
- "css_types/text_style.md" - "css_types/text_style.md"
- "css_types/vertical.md" - "css_types/vertical.md"
- Events: - Events: