Heyho,
使用角度材料时,我在 html/css 表和粘性标题方面遇到一些问题。
在我的项目中,我使用有角度的材料 sidenav<mat-sidenav-container>
, <mat-sidenav>
and <mat-sidenav-content>
。里面<mat-sidenav-container>
表格的粘性标题不起作用。
我在github上创建了一个小项目来轻松重现该问题:
Repo: https://github.com/ManticSic/angular-material-sticky-table-issue https://github.com/ManticSic/angular-material-sticky-table-issue
GH 页面:https://manticsic.github.io/angular-material-sticky-table-issue/ https://manticsic.github.io/angular-material-sticky-table-issue/
滚动时表头向下移动 64px,而不是固定在 y=64px。
你知道我该如何解决这个问题吗?
干杯,谢谢
Notes
- 如果标题粘贴/固定到页面顶部就可以了,因为当我在需要的地方使用此视图时,只显示一个表格。但我需要具有正确宽度的适当列。
- 我希望我的问题可以在没有 JavaScript 的情况下得到解决
- 该解决方案必须适用于最新版本的 firefox、chrome/chromium、safari 和三星移动浏览器
不起作用的解决方案
-
position:fixed
在 app-table-header 上并删除position:sticky
来自细胞:
不起作用,因为列宽不正确
删除/覆盖 mat-sidenav-container 和 mat-sidenav-content 的溢出属性将解决该问题
如果未设置,Angular Material 将自动生成 mat-sidenav-content。
导航.组件.sass
mat-sidenav-container, mat-sidenav-content
overflow: initial
感谢所有访问此问题的人!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)