CSS - 填充可用的剩余空间

标签 css layout

我正在尝试使用不同大小的图像创建选项拼接图,因此需要填充自由垂直空间。有什么方法可以使用 CSS 还是我需要以某种方式使用 JavaScript?

图片:http://imgur.com/TQYsNNC

<style>
  .options {
    width: 1230px;
    height: 100%;
    margin: auto;
    position: relative;
  }

  #stream .large {
    width: 400px;
    height: 575px;
    opacity: 0.8;
    position: relative;
    float: left;
    background: white;
  }

  #stream .big {
    width: 400px;
    height: 380px;
    margin-bottom: 10px;
    opacity: 0.8;
    position: relative;
    float: left;
    background: white;
  }

  #stream .medium {
    width: 400px;
    height: 185px;
    background: white;
    margin-bottom: 10px;
    opacity: 0.8;
    position: relative;
    float: left;
  }

  #stream .small {
    width: 195px;
    height: 185px;
    background: white;
    margin-bottom: 10px;
    opacity: 0.8;
    position: relative;
    float: left;
  }
</style>

最佳答案

不是真的;这就是 Javascript 库喜欢的 Masonry被 build 来做。 Masonry 易于使用,您应该可以将其放入并让它更紧密地排列您的元素。

关于CSS - 填充可用的剩余空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18926872/

相关文章:

css - 我怎样才能阻止 div 被推下?

c++ - Qt : Qlabel and QPushButton in a QVBoxLayout

html - 文本对齐在 Safari 的 'select' 元素中不起作用

html - 修改字体大小不影响其他类

html - 固定背景图像不断移动

ios - 自动布局、自定义 UITableViewCell、不断增长的标签

layout - graphviz - 如何以矩形布局循环排列节点?

css - 即使最小化,如何使布局居中?

html - 如何设置与另一半不同的 <hr> 样式?

javascript - 显示结果后清除 PHP 计算器屏幕