Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CSS - Vertical Align
/*http://zerosixthree.se/vertical-align-anything-with-just-3-lines-of-css/*/
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
}
@carlsednaoui

This comment has been minimized.

Copy link
Owner Author

carlsednaoui commented Feb 3, 2014

Here's another option:

.center-div {
  position: absolute;
  margin: auto;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100px;
  height: 100px;
  background-color: #ccc;
}

/src: http://www.tipue.com/blog/center-a-div/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.