2 ms·
Use margin: auto and absolute positioning to center something vertically. No tables or special magic needed. I think "margin: auto" maybe should have been writ
by pcwalton 11y ago
Use margin: auto and absolute positioning to center something vertically. No tables or special magic needed.
I think "margin: auto" maybe should have been written "margin: center" to make it more obvious, but the feature is there.
- vukers 11y agoAbsolute centering only works when the element you are trying to center has a defined height. If you are trying to center an element with unknown height inside a container with unknown height, the table-cell is likely the front-runner, sadly.