Skip to content

Instantly share code, notes, and snippets.

@MrCoder
Created March 11, 2021 06:44
Show Gist options
  • Save MrCoder/bb45d4fb1d1571b7b1508837c39a5cc2 to your computer and use it in GitHub Desktop.
Save MrCoder/bb45d4fb1d1571b7b1508837c39a5cc2 to your computer and use it in GitHub Desktop.
vertical-align: middle
http://phrogz.net/css/vertical-align/index.html
`vertical-align` can only be used on `table-cell` (such as td or elements with display: table-cell) and inline elements
(such as img or span with display:inline-block).
<div style="display:table-cell; vertical-align:middle"> ... </div>
<img align="middle" ...>
<img style="vertical-align:middle" ...>
<span style="display:inline-block; vertical-align:middle"> foo<br>bar </span>
When it is applied on normal block elements, most browsers set the value to inherit to all inline children of the element.
Use `align-items: center` on the container to vertically align items.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment