简体   繁体   中英

Height of angular-material table not going below certain minimum height

I am using mat-table in my project and would like to set the height of the rows to something like 20-30px.

When I set height: 25px what I get is actual height of 47.8px and if I set the height to something greater than 47.8px the row height increases, which means it's not a problem with css selectors and specificity.

I'm using the directive like so:

<table mat-table [dataSource]="dataSource" [ngClass]="classes"></table>

In my css I have:

.mat-cell, .mat-header-cell {
  padding: 0 10px;
  height: 25px;
}

I have checked and there doesn't appear to be a min-height attribute set anywhere.

You need to do:

.mat-row {
  height: 25px;
}

Here you can see a stackblitz demo .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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