Skip to content

Instantly share code, notes, and snippets.

@mildfuzz
Forked from nmsdvid/vertical-align-css
Created May 17, 2014 07:00
Show Gist options
  • Select an option

  • Save mildfuzz/77073d7456ce2dcab8ea to your computer and use it in GitHub Desktop.

Select an option

Save mildfuzz/77073d7456ce2dcab8ea to your computer and use it in GitHub Desktop.
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
}
SASS:
@mixin vertical-align {
position: relative;
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