I want to do with popup box to center. Width and height will dynamic.
margin:20px auto;
is ok without position:fixed;
. When I add position:fixed
; , it's not moving to center.
.jqbox_innerhtml
{
position: fixed;
width:500px;
height:200px;
background-color:#FFF;
padding:10px;
border:5px solid #CCC;
z-index:200;
margin: 5% auto;
}
how to move the box to the center with CSS ?
full code
<html>
<head>
<style>
body
{
margin:0px;
}
.jqbox_shadow
{
position: fixed;
width: 100%;
opacity: 0.9;
top:0px;
margin:0px;
min-height:200px;
height:100%;
z-index: 0;
background: #000;
font-size: 20px;
text-align: center;
}
.jqbox_innerhtml
{
position: fixed;
width:500px;
height:200px;
background-color:#FFF;
padding:10px;
border:5px solid #CCC;
z-index:200;
margin-left:auto;
margin-right: auto;
}
</style>
</head>
<body>
TSTING
<div class='jqbox_innerhtml'>
HELLO
</div>
<div class='jqbox_shadow'></div>
</body>
</html>