Translucent div background

I want to show some kind of dialog (an absolute positioned div), and I want to show it above a translucent 100% div, so everything in the background will be darkened. I dealt with her

<div class='transpBox'></div>

.transparentBox
{
    position: absolute;
    top: 0px;
    left: 0px;
    width: 100%;
    height: 100%;
    background-color: #white;
    opacity: 0.9;
    z-index: 499;
}

Everything is fine, but when the height of the dialog is greater than the height of the browser, and you scroll down, you see that the transparent div is not in full screen mode. What is the right way to do such a thing?

+3
source share
2 answers

position: absoluteUse instead position: fixed. (Use it also with the div dialog.)

absolutepage-based fixedpositions, window-based positions.

+3
source

, jquery . , . .

+1

Source: https://habr.com/ru/post/1740674/


All Articles