Vertical align anything with just 3 lines of CSS

Updated . Posted . Visible to the public. Deprecated.

We have card with all CSS centering options. You probably want to head over there and get an overview over what techniques are available for your use case and browser requirements.

See attached link. The gist is:

.element {
  position: relative;
  top: 50%;
  transform: translateY(-50%);
}

Works in all web browsers and IE9+.

Henning Koch
Last edit
Henning Koch
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2014-07-31 12:10)