I have what I thought was a simple task : given x items, show them in a grid, with each column being the width of the content. If the number of columns exceeds the width of the container, create a new row and continue
I have managed to get the columns to display and wrap, but only if I define a fixed-width for the column
https://stackblitz.com/edit/angular4-dxkvmt
how can I make each "label" on each row fit to the content but move to a new row when the number of labels would exceed the available view space ?
I have tried
grid-template-columns: repeat(auto-fill,max-content);
this gives one row per label
grid-template-columns: repeat(auto-fill,minmax(20px,max-content));
makes all columns 20px .. but they do flow properly on resize
would appreciate some pointers. I am not particularly skilled at css grid so may have overlooked something easy
display: flex
andflex-wrap: wrap
instead of grid. – Caddell