I have a page with a form
and a div
:
<body>
<form id="form1" runat="server">
...
</form>
<div id="wizardDiv" style="width: 100%; height: 100%;background-color:black;display:none">
<div style="background-color:#8DA5C6; z-index:999; width: 50%; margin: 0 auto;">
...
</div>
</div>
</body>
On a button click, I make the div
visible, and I want it to cover the whole page, while the inner div
is right in the middle (in the center, both horizontally and vertically.) just like a popup modal.
To illustrate:
The current html fails the following:
- The
div
is not covering the whole page, it is located after theform
, instead overlaying it. - The inner
div
is only horizontally centered and not vertically.
What am I missing here?
Is my approach is "browser-compatibility" safe? (Maybe I should look for a Jquery solution?)
Final Solution:
I ended up using:
- Didier G answer for the overlay problem.
- Jquery to center the div on screen
- CSS3 for rounding the corners of the div