html, body { padding: 0; margin: 0; height: auto; width: 100%; color: #fff; text-align: center; font-size: 20px; } #clear_first { position: relative; background: #c8504b; opacity: 0.4; height: 300px; width: 100%; top: 0; } #clear_second { position: relative; background: #ccc; opacity: 1; height: 700px; width: 100%; top: 0; } #clear_third { position: relative; background: #000000; opacity: 0.9; height: 700px; width: 100%; top: 0; } #paral { position: absolute; background: url(https://kondainfo.ru/images/delim_10.jpg) no-repeat bottom fixed; background-size: 100% 200px; height: 100px; width: 100%; margin: 0 auto; left: 0; bottom: 0; border-top: 1px solid; } <div id="clear_first">Начало</div> <div id="clear_second"> <div id="paral">Фото параллакса</div> </div> <div id="clear_third">Конец</div> Hello everyone! Please help me fix the background of the div block so that it can stop and not fall into the abyss along with the slider. I decided to add to my site (I'm still quite a novice) as simple as a stool the effect of parallax. The code is cut off.
jsfiddle.net/acsoncry/655zna8L The problem is that the image is only 200 pixels high, and the block itself is two times thinner. When you scroll down the page, at some point the parallax picture scrolls and the image disappears, leaving an empty area. I tried many ways to create parallaxes, including stopping the block when another is reached (I set foot myself, the block stands still, only the picture moves ...), but it considers large-sized photos that replace each other. In my case, the block is narrow and the picture seems to be "jumping" there, but there is no bottom for the block. Is it possible to limit the height of the block itself in any way? I tried to make background-size: 100% 100%; but then the picture stretches to the height of the screen ... Help please!