Vertically center arbitrarily sized content without the use of JS
Using CSS's inline-block, a pseudo-element and vertical-align you can vertically center any element of any or changing size with about 20 lines of CSS.
Written by Andrew Jaswa
Related protips
3 Responses
You don't even need 20 lines of CSS. See http://coderwall.com/p/oo2bqg (and first comment for the pseudo-element version).
over 1 year ago
·
@passcod Ahh good call. I guess I forgot to mention that mine also horizontally centers the element as well with out interfering with much else.
over 1 year ago
·
Well, the actual "payload" of vertically aligning css code is only under 10 lines :)
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Css
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#