diff --git a/docs/examples/styles/text_align.css b/docs/examples/styles/text_align.css index c594254d6..32714ba23 100644 --- a/docs/examples/styles/text_align.css +++ b/docs/examples/styles/text_align.css @@ -1,24 +1,29 @@ #one { - text-align: left; - background: lightblue; - + text-align: left; + background: lightblue; } #two { - text-align: center; - background: indianred; + text-align: center; + background: indianred; } #three { - text-align: right; - background: palegreen; + text-align: right; + background: palegreen; } #four { - text-align: justify; - background: palevioletred; + text-align: justify; + background: palevioletred; } -Static { - padding: 1; +Label { + padding: 1 2; + height: 100%; + color: auto; +} + +Grid { + grid-size: 2 2; } diff --git a/docs/examples/styles/text_align.py b/docs/examples/styles/text_align.py index 27e2892fa..0c72a17f3 100644 --- a/docs/examples/styles/text_align.py +++ b/docs/examples/styles/text_align.py @@ -1,7 +1,6 @@ -from __future__ import annotations - -from textual.app import App, ComposeResult -from textual.widgets import Static +from textual.app import App +from textual.containers import Grid +from textual.widgets import Label TEXT = ( "I must not fear. Fear is the mind-killer. Fear is the little-death that " @@ -11,18 +10,13 @@ TEXT = ( class TextAlign(App): - def compose(self) -> ComposeResult: - left = Static("[b]Left aligned[/]\n" + TEXT, id="one") - yield left - - right = Static("[b]Center aligned[/]\n" + TEXT, id="two") - yield right - - center = Static("[b]Right aligned[/]\n" + TEXT, id="three") - yield center - - full = Static("[b]Justified[/]\n" + TEXT, id="four") - yield full + def compose(self): + yield Grid( + Label("[b]Left aligned[/]\n" + TEXT, id="one"), + Label("[b]Center aligned[/]\n" + TEXT, id="two"), + Label("[b]Right aligned[/]\n" + TEXT, id="three"), + Label("[b]Justified[/]\n" + TEXT, id="four"), + ) app = TextAlign(css_path="text_align.css") diff --git a/docs/styles/text_align.md b/docs/styles/text_align.md index cc72ac2d1..dc55dc03e 100644 --- a/docs/styles/text_align.md +++ b/docs/styles/text_align.md @@ -35,7 +35,7 @@ This example shows, from top to bottom: `left`, `center`, `right`, and `justify` === "text_align.css" - ```css + ```css hl_lines="2 7 12 17" --8<-- "docs/examples/styles/text_align.css" ```