Created
September 11, 2013 13:11
-
-
Save clowder/6523364 to your computer and use it in GitHub Desktop.
CSS Hack: Force vertical center.
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
module ApplicationHelper | |
def force_vertical_center(opts={}) | |
raise ArgumentError, "Missing block" unless block_given? | |
capture_haml do | |
haml_tag '.vertical-center', opts do | |
haml_tag '.inner', &Proc.new | |
end | |
end | |
end | |
end |
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
.vertical-center { | |
height: 100%; | |
width: 100%; | |
display: table; | |
> .inner { | |
display: table-cell; | |
vertical-align: middle; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment