Skip to content

Instantly share code, notes, and snippets.

@coybit
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save coybit/9171935 to your computer and use it in GitHub Desktop.

Select an option

Save coybit/9171935 to your computer and use it in GitHub Desktop.
.parent {
position: relative;
}
.child {
position: absolute;
display: block;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
}
<div class="parent">
<i class="child"></i>
</div>
@coybit
Copy link
Author

coybit commented Mar 2, 2014

For

<div class='CenterizeMyChild'>
  <div>...</div>
  <div>...</div>
</div>
.CenterizeMyChildren {
display: table;
margin: 0 auto;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment