Skip to content

Instantly share code, notes, and snippets.

@AverageMarcus
Created January 13, 2014 19:44
Show Gist options
  • Save AverageMarcus/8406632 to your computer and use it in GitHub Desktop.
Save AverageMarcus/8406632 to your computer and use it in GitHub Desktop.
// Pure CSS
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
}
// Less 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%);
}
// Sass Placeholder Selector
%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%);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment