Link to home
Start Free TrialLog in
Avatar of okanagan
okanagan

asked on

CSS div to 100% of page size

Hi -

I need a div to be 100% of the page height, rather than the browser window height.  Here's my div style:

#lyrMask {
      z-index: 2;  
      visibility: hidden;
      position: absolute;
      left: 0px;
      top: 0px;
      width: 100%;
      height: 200%;
      -moz-opacity: 0.6;
      opacity: .60;
      filter: alpha(opacity=60);
      background-color: #CCC;
}

This is a mask over which I place a "pop-up" for users to make a selection on.  The mask is to prevent them from clicking anything else on the underlying page and to focus their attention on the div placed on top of the mask outlined above.  The problem is that they can simply scroll down the page, and since the mask is only as high as the browser window, they have access to any links below the mask.

Any ideas?

Thanks,

Rod
Avatar of TName
TName

Set all it's ancestor elements' height to 100%, including html and body:

html, body {height:100%;}

#theMasksParent {height:100%;}
and so on...
ASKER CERTIFIED SOLUTION
Avatar of Saqib Khan
Saqib Khan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SnowFlake
any idea why on ie7 i get 4 pixels to many in the result for height returned by getPageSizeWithScroll  ?

SnowFlake