自定义 jekyll frontpage,使用 post 个变量生成的元素。身高问题

custom jekyll frontpage, with a generated elements out of post variables. height problem

我的问题是无法识别内容的高度,这导致主体小于内容,从而导致更多问题。

HTML:

<section id="contentbox">   
  {% for post in site.posts %}
  <article>
    <h2>
      <a href="{{ post.url }}">
        {{ post.title }}
      </a>
    </h2>
    <time datetime="{{ post.date | date: "%Y-%m-%d" }}">{{ post.date | date_to_long_string }}</time>
    <p>
      {{ post.caption }}
    </p>
  </article>
{% endfor %}
</section>

CSS:

#contentbox {
      height: 100%;
}
article {
  width: 45%;
  float: left;
  height: 120px;
  padding: 2px 0 0 2px;
}

我列出了一堆文章,但该部分保留 height:0

在浮动元素之后放置一个清晰的固定元素。 例如:<div style="clear: both;"></div>

这是一个很常见的问题。