Skip to content

Instantly share code, notes, and snippets.

@austinhinderer
Created September 19, 2013 02:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save austinhinderer/6618501 to your computer and use it in GitHub Desktop.
Save austinhinderer/6618501 to your computer and use it in GitHub Desktop.
This SASS mixin will vertically center a child element inside its parent.
@mixin vertical-center($childSelector) {
& {
display: table;
width: 100%;
#{$childSelector} {
display: table-cell;
text-align: center;
vertical-align: middle;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment