Skip to content

Instantly share code, notes, and snippets.

@emaildano
Created November 4, 2013 02:15
Show Gist options
  • Save emaildano/7297166 to your computer and use it in GitHub Desktop.
Save emaildano/7297166 to your computer and use it in GitHub Desktop.
Vertically Center Div
var parentHeight = $('#parent').height();
var childHeight = $('#child').height();
$('#child').css('margin-top', (parentHeight - childHeight) / 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment