扫码关注官方订阅号
当我鼠标滑动的时候,遮罩层也会跟着背景的滚动而滚动,但是我用fixed把页面定住了后,背景也也会跟着定住,怎样单独控制遮罩层页面?
小伙看你根骨奇佳,潜力无限,来学PHP伐。
参考:移动端滚动穿透问题完美解决方案
用fix定位遮罩层
.遮罩{ position: fixed; top: 0; left: 0; }
这样是不是?
<!DOCTYPE html> <html> <head> <title></title> <style type="text/css"> .one { background: red; height: 500px; } .two { background: blue; height: 500px; } .overlay { position: fixed; background: #ccc; opacity: 0.8; left: 0; top: 0; width: 100%; height: 100%; } </style> </head> <body> <p class="one"></p> <p class="two"></p> <p class="overlay"></p> </body> </html>
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
参考:移动端滚动穿透问题完美解决方案
用fix定位遮罩层
这样是不是?