--- title: Display table centering tags: layout,intermediate --- Vertically and horizontally centers a child element within its parent element using `display: table` (as an alternative to `flexbox`). - `display: table` on '.center' allows the element to behave like a `
| HTML element.
- `text-align: center` on '.center > span' centers the child element horizontally.
- `vertical-align: middle` on '.center > span' centers the child element vertically.
- The outer parent ('.container' in this case) must have a fixed height and width.
```html
Centered content
|