From the sound of it, your modal element is inside of the container. I'm guessing you have markup like this.
<div id="container">
<span>children</span>
<p>more children>
<div id="modal">
Modal text!
</div>
</div>
And CSS like this...
.noprint { display: none;}
.print {display: block;}
Which you use JavaScript to apply, like this:
<div id="container" class="noprint">
<span>children</span>
<p>more children>
<div id="modal" class="print">
Modal text!
</div>
</div>
In these examples, the #modal
element is inside of a hidden container. The CSS spec dictates that if a parent element is hidden, all children will be hidden also, even if they are set to display: block
(or any other valid display
value) or are absolutely positioned.
What you should do if you want to hide everything on the page except for your modal window is get your markup to be structured something like this:
<div id="modal">
Modal Text!
</div>
<div id="container">
<span>children</span>
<p>more children>
<div id="modal">
Modal text!
</div>
</div>
If you have no control over where the modal element is rendered, you can use jQuery to re-position the modal element. Keep in mind that this may impact your modal window's layout:
// Moves the element outside of the hidden container
$("#container").before($("#modal"));