tags:

views:

101

answers:

2

How to open div on center screen position ?

A: 
div{

margin-left: auto;
margin-right: auto;
}

This only works if the div has a width of 95% or less

John
If you want it to open like a window check out plugins such as http://jqueryui.com/demos/dialog/
John
A: 

You can define a size for the DIV and position it absolutely (or Fixed), like this:

div{
     position:absolute; /* can also be 'fixed' */
     top:50%; left:50%; 
     width:200px; height:100px; 
     margin:-100px 0 0 -50px;
     z-index:99;
}

Or if you don't want to place it absolutly positioned, you can give it a width, and set it to:

div{ margin:0 auto; }
vsync
but that is a CSS or Javascript question? if the width and height are unknown, than it's a JS question, and then you need to measure the size of the div, and set the CSS accordingly.
vsync