grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
时间: 2024-05-20 21:16:12 浏览: 132
grid-cheatsheet:CSS网格备忘单
This grid-template-columns property will create a grid with columns that have a minimum width of 300px and a maximum width of 1fr, which means the columns will take up equal amounts of remaining space. The auto-fit function will automatically adjust the number of columns based on the width of the container, so that as the container shrinks, the number of columns will decrease and the column width will increase, maintaining the minimum width of 300px. This is useful for creating responsive layouts that adjust to different screen sizes.
阅读全文