Skip to content

Instantly share code, notes, and snippets.

@roxanneallard
Created January 31, 2019 18:02
Show Gist options
  • Save roxanneallard/19fe141998a6edf1f3adef4a8aa304c9 to your computer and use it in GitHub Desktop.
Save roxanneallard/19fe141998a6edf1f3adef4a8aa304c9 to your computer and use it in GitHub Desktop.
Vertical Align
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
}
/* Mixin */
@mixin vertical-align($position: relative) {
position: $position;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
.element p {
@include vertical-align();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment