Created
June 18, 2015 00:01
-
-
Save derryl/7cdf9642397d68612d89 to your computer and use it in GitHub Desktop.
Vertical alignment mixins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Vertically center objects of dynamic size | |
// Note: - correct mixins must be applied to both parent and child | |
// - if it doesn't work, check for conflicting styles on those elements | |
// Apply to container element | |
.contain-vertically-centered-content, .contain-vc { | |
&:before { | |
content: ''; | |
display: inline-block; | |
height: 100%; | |
vertical-align: middle; | |
margin-right: -0.25em; | |
} | |
} | |
// Apply to element which should be centered vertically | |
.vertically-center, .vc { | |
display: inline-block; | |
vertical-align: middle; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment