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
2010-05-13 07:07:27
If you want it to open like a window check out plugins such as http://jqueryui.com/demos/dialog/
John
2010-05-13 07:10:22
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
2010-05-13 07:23:21
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
2010-05-13 07:25:55