【发布时间】:2017-02-05 19:01:07
【问题描述】:
这是我设法使其适用于简单响应式网格的简单 CSS(plunker):
.flex {
display: flex;
flex-direction: column;
flex-wrap: wrap;
}
.flex > * {
flex-grow: 1;
/* drives IE11 crazy for some reason */
/*flex-basis: 0;*/
padding: 20px;
}
@media screen and (min-width: 600px) {
.flex {
flex-direction: row;
}
.flex > * {
flex-basis: calc(50% - 40px);
}
}
@media screen and (min-width: 992px) {
.flex {
flex-direction: row;
}
.flex > * {
flex-basis: calc(25% - 40px);
}
}
对于指定的断点,它为 4 项工作:
1 + 1 + 1 + 1
2 + 2
4
对于 3 个项目:
1 + 1 + 1
2 + 1
3
它给了我 5 件物品:
1 + 1 + 1 + 1 + 1
2 + 2 + 1
4 + 1
它符合flex-basis,但我想得到
3 + 2
最后一个断点。
如何使这个 CSS 在最后一个断点上为 3 + 2 的 5 个项目工作(第一行 3 个项目,第二行 2 个项目)?
【问题讨论】:
标签: css responsive-design flexbox