pigmentarts
asked on
center CSS box on screen
i need to center the CSS alert box on screen in any screen size, possible?
<style>
<!--Message box css-->
div#modalContainer { background-color:transpare nt; position:absolute; width:100%; height:100%; top:0px; left:0px; z-index:10000; }
#alertBox { position:absolute; width:300px; min-height:100px; margin-top:50px; margin-left:9em; border:1px solid #000; background-color:#F2F5F6; z-index:12000; }
div#modalContainer > #alertBox { position:fixed; }
#modalContainer #alertBox h1 {color:#fff; margin:0; font-size:0.8em; background-color:#4e9600; border-bottom:1px solid #000; padding:5px; }
#alertBox p { font:0.7em verdana,arial; height:50px; padding-left:5px; margin-left:55px; }
#alertBox #closeBtn { color:#fff; display:block; position:relative; margin:5px auto; padding:3px; border:1px solid #000; width:70px; font-size:0.7em; text-transform:uppercase; text-align:center; background-color:#4e9600; text-decoration:none; }
</style>
<style>
<!--Message box css-->
div#modalContainer { background-color:transpare
#alertBox { position:absolute; width:300px; min-height:100px; margin-top:50px; margin-left:9em; border:1px solid #000; background-color:#F2F5F6; z-index:12000; }
div#modalContainer > #alertBox { position:fixed; }
#modalContainer #alertBox h1 {color:#fff; margin:0; font-size:0.8em; background-color:#4e9600; border-bottom:1px solid #000; padding:5px; }
#alertBox p { font:0.7em verdana,arial; height:50px; padding-left:5px; margin-left:55px; }
#alertBox #closeBtn { color:#fff; display:block; position:relative; margin:5px auto; padding:3px; border:1px solid #000; width:70px; font-size:0.7em; text-transform:uppercase; text-align:center; background-color:#4e9600; text-decoration:none; }
</style>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
added the following
height:200px;
top:50%;
left:50%;
margin:-100px auto auto -150px;
and removed
min-height:100px;
margin-top:50px;
margin-left:9em;
height:200px;
top:50%;
left:50%;
margin:-100px auto auto -150px;
and removed
min-height:100px;
margin-top:50px;
margin-left:9em;
ASKER