如何给角材料表赋予固定高度 [英] How to give fixed height to Angular Material Table
本文介绍了如何给角材料表赋予固定高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个angular material table(10 rows)
,我想将其高度固定为300px(应该使用垂直滚动查看多余的行).当我将样式的高度赋予300px
时,它没有任何作用.
该表的内容超出了给定的高度.
I have an angular material table(10 rows)
for which i want to fix the height to 300px(Vertical scroll should be used to see the extra rows). When i give height in the styles to 300px
it is not having any effect.
The contents of the table are going out of the height given.
查看图片链接.
我想在两个表之间一个接一个,并且希望它们相等.height 50%.
第一个表本身取10 rows height
.
I want to have two tables one below another and i want to give them equal height 50%.
The first table itself taking 10 rows height
.
推荐答案
我在类中使用了包装div
I use a wrapper div with class
<div class="table-container">
<table mat-table [dataSource]=.....>
</table>
</div>
这是课程
.table-container {
margin-top: 10px;
max-height: 300px;
overflow: auto;
}
这篇关于如何给角材料表赋予固定高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文