Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

set div full screen even when scroll the page

Tags:

html

css

I want to set #bodyHider full screen. I tried this code:

#bodyHider{
    position:absolute;
        width:100%;
    height:100%;
    background:#000;
    opacity: 0.7;
    filter: alpha(opacity=70); /* For IE8 and earlier */
    z-index:10000;
}

the HTML code:

<div id="bodyHider"></div>

It worked, but when I scroll down, I see #bodyHider is at the top of the page. I want this div whole screen even if I scroll the page.

like image 435
Swister Avatar asked Dec 20 '25 08:12

Swister


1 Answers

This is what you want.

#bodyHider{
    position:fixed;
    top:0;
    width:100%;
    height:100%;
    background:#000;
    opacity: 0.7;
    filter: alpha(opacity=70); /* For IE8 and earlier */
    z-index:10000;
}
like image 100
vanntile Avatar answered Dec 21 '25 21:12

vanntile



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!