Css衣衫褴褛,什么意思?

Css ragged bottom, what does it mean?

查看不同的砌体方法,具体查看此处的摘要

https://css-tricks.com/piecing-together-approaches-for-a-css-masonry-layout/

据说:"Is vertical order with ragged bottoms OK?"

用代码笔理论上显示这个破烂的底部,这里 https://codepen.io/chriscoyier/pen/NeRNBO or here https://codepen.io/chriscoyier/pen/XojXxy

可是我看不到破烂的下装在哪里

我需要一些线索,还是浏览器已经解决了这个问题?

(codepen中的做法,纯css)

.masonry-with-columns {
  columns: 6 200px;
  column-gap: 1rem;
  div {
    width: 150px;
    background: #EC985A;
    color: white;
    margin: 0 1rem 1rem 0;
    display: inline-block;
    width: 100%;
    text-align: center;
    font-family: system-ui;
    font-weight: 900;
    font-size: 2rem;
  } 
  @for $i from 1 through 36 { 
    div:nth-child(#{$i}) {
      $h: (random(400) + 100) + px;
      height: $h;
      line-height: $h;
    }
  }
}

(或基于 flex 的)

.masonry-with-flex {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  max-height: 1000px;
  div {
    width: 150px;
    background: #EC985A;
    color: white;
    margin: 0 1rem 1rem 0;
    text-align: center;
    font-family: system-ui;
    font-weight: 900;
    font-size: 2rem;
  } 
  @for $i from 1 through 36 { 
    div:nth-child(#{$i}) {
      $h: (random(400) + 100) + px;
      height: $h;
      line-height: $h;
    }
  }
}

您问题中的屏幕截图展示的是破烂底裤的完美示例。事实上,链接的文章指出你需要接受 "Vertical Ordering and Ragged Bottoms"。

目前单靠 CSS 无法实现齐平砌体。 subsequent section 标题为 你需要干净的底边吗? Flexbox/JavaScript 组合可以提供帮助。 展示了一种有效的混合方法。