Update text style reference.

[skip ci]
This commit is contained in:
Rodrigo Girão Serrão
2023-01-06 14:18:50 +00:00
parent 72d3171a79
commit 583b1273ac

View File

@@ -1,29 +1,27 @@
# Text-style
The `text-style` rule enables a number of different ways of displaying text.
Text styles may be set in combination.
For example `bold underline` or `reverse underline strike`.
The `text-style` sets the style for the text in a widget.
## Syntax
```
text-style: <TEXT STYLE> ...;
```
--8<-- "docs/snippets/syntax_block_start.md"
text-style: <a href="../../css_types/text_style">&lt;text-style&gt;</a>;
--8<-- "docs/snippets/syntax_block_end.md"
`text-style` will take all the values specified and will apply that styling combination to the text in the widget.
### Values
| Value | Description |
|-------------|----------------------------------------------------------------|
| `bold` | **bold text** |
| `italic` | _italic text_ |
| `reverse` | reverse video text (foreground and background colors reversed) |
| `underline` | <u>underline text</u> |
| `strike` | <s>strikethrough text</s> |
--8<-- "docs/snippets/type_syntax/text_style.md"
## Example
## Examples
Each of the three text panels has a different text style.
Each of the three text panels has a different text style, respectively `bold`, `italic`, and `reverse`, from left to right.
=== "Output"
```{.textual path="docs/examples/styles/text_style.py" lines=14}
```
=== "text_style.py"
@@ -37,9 +35,23 @@ Each of the three text panels has a different text style.
--8<-- "docs/examples/styles/text_style.css"
```
The next example shows all different styles on their own, as well as some combinations of styles in a single widget.
=== "Output"
```{.textual path="docs/examples/styles/text_style.py"}
```{.textual path="docs/examples/styles/text_style_all.py"}
```
=== "text_style_all.py"
```python
--8<-- "docs/examples/styles/text_style_all.py"
```
=== "text_style_all.css"
```css
--8<-- "docs/examples/styles/text_style_all.css"
```
## CSS