Skip to content

Instantly share code, notes, and snippets.

@clowder
Created September 11, 2013 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clowder/6523364 to your computer and use it in GitHub Desktop.
Save clowder/6523364 to your computer and use it in GitHub Desktop.
CSS Hack: Force vertical center.
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
.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