md-table - How to update the column width

后端 未结 18 2158
离开以前
离开以前 2020-12-04 10:58

I have started using the md-table for my project, and I want fixed column width. Currently all columns width are divided into equal size.

Where can I get the documen

18条回答
  •  悲&欢浪女
    2020-12-04 11:12

    I got the very easy solution for this - setting different width for column in style sheet by overriding the both cell and header cell:

    Example - setting custom width for 1st and 5th column:

    .mat-cell:nth-child(1),
    .mat-header-cell:nth-child(1) {
      flex: 0 0 5%;
    }
    .mat-cell:nth-child(5),
    .mat-header-cell:nth-child(5) {
      flex: 0 0 10%;
    }
    

    github

提交回复
热议问题