简体   繁体   English

角度材料6 sidenav使用100%页面高度/ mat-table滚动

[英]angular material 6 sidenav use 100% page height / mat-table scroll

Hi I'm fighting now for hours with css - I hope you can help me: 嗨,我现在用css打了好几个小时 - 我希望你能帮助我:

I try to set my to fixed 100% height. 我尝试将我设置为固定的100%高度。 The child mat-table should than also resize and not extend above 100% age size if it has more data rows. 如果子数据行有更多的数据行,那么子数据表也应该调整大小并且不要超过100%年龄。 (mat-table now supports scrolling and sticky header and footer rows. This is why I like to give my SPA a new design) (mat-table现在支持滚动和粘贴的页眉和页脚行。这就是为什么我喜欢给我的SPA一个新的设计)

Here is an example how it should look: https://stackblitz.com/edit/ng-fullpage-scrolltable but this has a fixed setting .mat-table { height: 400px;} (and the mat-table nicely scroll if more than 5 items are displayed) 下面是一个示例: https//stackblitz.com/edit/ng-fullpage-scrolltable但它有一个固定的设置.mat-table { height: 400px;} (如果更多,mat-table会很好地滚动超过5项显示) 在此输入图像描述

How can i make this height (or better the height of the whole mat-sidenav-container or body expand to 100% 我怎样才能达到这个高度(或更好的整个垫子侧面容器或身体的高度扩展到100%

Use 采用

.mat-table {
  height: calc( 100vh - 250px);
  overflow: auto; 
  width: 100%;
}

I tried id in your stackblitz and worked 我在你的stackblitz尝试了id并且工作了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM