代码之家  ›  专栏  ›  技术社区  ›  JmJ

CSS flex-向上移动以填充垂直空间[复制]

  •  0
  • JmJ  · 技术社区  · 6 年前

    我需要实施一个公平的厂外砖石布局。但是,出于许多原因,我不想使用JavaScript来完成这项工作。

    A grid of multiple columns of rectangles of varying height.

    参数:

    • 元素的高度无法在服务器端计算(图像加上不同数量的文本)
    • 如果必须的话,我可以忍受固定数量的专栏

    the column-count property.

    该解决方案的问题是元素按列排序:

    Starting from the top leftmost box, they're numbered 1 through 4 straight down, the topmost box in the next column is 5, and so on.

    Starting from the top leftmost box, they're numbered 1 through 6 straight across, but because box 5 is the shortest the box underneath it is 7 as it has the appearance of being on a row higher than the next box on the far left.

    我尝试过的方法不起作用:

    现在我 更改服务器端的呈现并重新排序将项目数除以列数的项目,但这很复杂,容易出错(基于浏览器决定如何将项目列表拆分为列),因此我希望尽可能避免这种情况。

    0 回复  |  直到 6 年前