Update the centring FAQ to reference Center

See #2263.
This commit is contained in:
Dave Pearson
2023-04-14 12:09:25 +01:00
parent 898de5a69c
commit ee8153c9ed

View File

@@ -69,23 +69,15 @@ If you want them more like this:
+---------------+ +---------------+
``` ```
the best approach is to wrap each widget in a container that individually the best approach is to wrap each widget in a [`Center`
centers it. For example: container](https://textual.textualize.io/api/containers/#textual.containers.Center)
that individually centers it. For example:
```python ```python
from textual.app import App, ComposeResult from textual.app import App, ComposeResult
from textual.containers import Container from textual.containers import Center
from textual.widgets import Button from textual.widgets import Button
class Center( Container ):
DEFAULT_CSS = """
Center {
height: auto;
width: 100%;
align: center middle;
}
"""
class ButtonApp(App): class ButtonApp(App):
CSS = """ CSS = """