md-table - How to update the column width

后端 未结 18 2138
离开以前
离开以前 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:18

    I found a combination of jymdman's and Rahul Patil's answers is working best for me:

    .mat-column-userId {
      flex: 0 0 75px;
    }
    

    Also, if you have one "leading" column which you want to always occupy a certain amount of space across different devices, I found the following quite handy to adopt to the available container width in a more responsive kind (this forces the remaining columns to use the remaining space evenly):

    .mat-column-userName {
      flex: 0 0 60%;
    }
    

提交回复
热议问题