html - How to align a box at middle of page without using margin? -


i trying box @ middle of page without using margin.

i tried-

.box-middle { vertical-align:middle; height:100px; width:100px; border:1px solid #ddd;  } 

this doesn't work @ all-

but things setting margin property works , don't want use margin. because giving margin breaks responsive web design.

so have login form , want set @ middle of page.

please guide !

here can tricks box-

please align me middle

use following jquery code :

  $(window).resize(function(){    $('.classname').css({     position:'absolute',     left: ($(window).width() - $('.classname').outerwidth())/2,     top: ($(window).height() - $('.classname').outerheight())/2   });    }); 

// run function:

 $(window).resize(); 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -