Modal Div to fill entire window including below fold
I have an absolute positioned div that I need to get to to fill the entire document for a background to a modal window.
I can get it to fill the window but when there is a scroll bar it doesnt fill the area that is currently visible.
This is my current code:
position:absolute;
top:0;
left:0;
height:100%;
min-height:100%;
By the开发者_高级运维 way I can get it to fill the document horizontally.
Give the div position:fixed
and top,bottom,left,right 0
See here: http://jsfiddle.net/sQLPr/
edit - removed the following line
- and it's parent (probably body) position:relative
div.covered {position: fixed; top:0; left:0; bottom:0; right:0;}
test it here: http://jsfiddle.net/meo/kGUYG/2/
Position absolute is gonna scroll when you scroll the page unless you find a JS solution. You need to use position fixed so the element does not scroll when the content does.
Put it in a table with 100% width and that's all
精彩评论