Skip to content

Instantly share code, notes, and snippets.

@javierarques
Created June 18, 2014 07:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javierarques/95b6c1ee0384b0419e18 to your computer and use it in GitHub Desktop.
Save javierarques/95b6c1ee0384b0419e18 to your computer and use it in GitHub Desktop.
A Pen by Javier.
<div class="table container">
<div class="table-cell">
<code>display: table-cell;</code>
</div>
</div>
<div class="wrapper container">
<div class="inline-block">
<code>display: inline-block;</code>
</div>
</div>
/* COMMON */
.container{
border: 2px solid #333;
text-align:center;
padding: 1em;
margin-bottom: 1em;
height: 200px;
}
/* TABLES */
.table{
display: table;
width: 100%;
}
.table-cell{
display: table-cell;
vertical-align: middle;
}
/* INLINE BLOCK */
.wrapper:before{
content: "";
display: inline-block;
height: 100%;
vertical-align: middle;
width: 1px;
}
.inline-block{
display: inline-block;
vertical-align: middle;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment