我的 ASP.NET Core MVC 项目中的页面有以下 css 样式表:
body {
background-repeat: no-repeat;
background: linear-gradient(30deg, rgba(121, 110, 255, 0.95) 0%, rgba(33, 200, 122, 0.95) 100%);
background: -webkit-linear-gradient(30deg, rgba(121, 110, 255, 0.95) 0%, rgba(33, 200, 122, 0.95) 100%);
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
resize: both;
overflow: auto;}
添加该行后overflow: auto;
,效果是,我无法使用 MS Edge 上的鼠标滚轮垂直滚动页面。所有其他浏览器都可以正常工作。
有对一个线程在这里,但没有有效的建议或帮助,已经提供。此线程已锁定。
任何建议或解决方法?
在您的情况下,overflow: auto;
仅用于固定背景,因为您将其应用于整个身体。(旁注:您可能想要做overflow : scroll
而不是auto
)
但是修复背景的正确方法是使用background-attachment: fixed;
:
body {
background-repeat: no-repeat;
background: linear-gradient(30deg, rgba(121, 110, 255, 0.95) 0%, rgba(33, 200, 122, 0.95) 100%);
background: -webkit-linear-gradient(30deg, rgba(121, 110, 255, 0.95) 0%, rgba(33, 200, 122, 0.95) 100%);
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
resize: both;
background-attachment: fixed;
}
我猜“错误”是因为您的代码在已经可以滚动的页面内创建了一个可滚动元素。也许尝试在滚动之前单击您的页面以确保舒尔。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句