LppEdd
LppEdd

Reputation: 21134

Material Table column fixed width

I have an Angular Material table, and I'd like to apply a fixed width of 100px to the first column.

enter image description here

I tried using:

.mat-column-select {
  flex: 0 0 100px !important;
}

with no effect.

What am I missing?

Edit: Ok... I'm not a CSS guy. Just adding width: 100px did the trick. Why?

Upvotes: 0

Views: 6219

Answers (1)

blackcityhenry
blackcityhenry

Reputation: 727

Congratulations for finding the solution on your own.

The table is a <table> element. Which is not default display: flex. flex: 0 0 100px will only work if the parent element is a flex box.

Since <td> is displayed as table-cell. Thats why width: 100px should do the work.

Upvotes: 1

Related Questions