Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
CSS - Vertical Align
.element {
position: relative;
top: 50%;
transform: translateY(-50%);

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;


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.