Vertical Center


/ Published in: CSS
Save to your folder(s)

This snippet allows to vertically center the contents of a container without any extra markup by simply displaying it as a table cell. This allows you to use the vertical-align attribute.


Copy this code and paste it in your HTML
  1. .container {
  2. min-height: 10em;
  3. display: table-cell;
  4. vertical-align: middle;
  5. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.