Return to Snippet

Revision: 31142
at August 30, 2010 23:04 by Ethyde


Initial Code
$(window).resize(function(){

	$('.className').css({
		position:'absolute',
		left: ($(window).width() - $('.className').outerWidth())/2,
		top: ($(window).height() - $('.className').outerHeight())/2
	});

});

// To initially run the function:
$(window).resize();

Initial URL
http://tutorialzine.com/2010/03/centering-div-vertically-and-horizontally/

Initial Description


Initial Title
Centrer une div horizontalement et verticalement avec jQuery

Initial Tags


Initial Language
jQuery