Skip to content

Instantly share code, notes, and snippets.

@xiaohutai
Created January 13, 2014 13:37
Show Gist options
  • Save xiaohutai/8400347 to your computer and use it in GitHub Desktop.
Save xiaohutai/8400347 to your computer and use it in GitHub Desktop.
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
}
@mixin vertical-align {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-o-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
.element p {
@include vertical-align;
}
@xiaohutai
Copy link
Author

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