diff --git a/snippets/display-table-centering b/snippets/display-table-centering new file mode 100644 index 000000000..11a4629d6 --- /dev/null +++ b/snippets/display-table-centering @@ -0,0 +1,80 @@ +### Display Table Centering + +Vertically and horitonally centers a child element within its parent element using `display: table` (as an alternative to `flexbox`). + +#### HTML + +```html +
| HTML element. +2. `text-align: center` on '.center > span' centers the child element horizontally. +2. `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. + +#### Browser support + +✅ No caveats. + +* https://caniuse.com/#search=display%3A%20table + + |