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

标签 html css jekyll jekyll-theme

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

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;
}

我列出了一堆文章,但该部分保持高度:0

最佳答案

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

这是一个非常普遍的问题。

关于html - 自定义 jekyll frontpage,使用 post 变量生成的元素。高度问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55101878/

相关文章:

windows-8 - Jekyll Serve 不工作。未初始化的常量。 window 8

jekyll 在本地工作,但在 github 上不工作。要导入的文件未找到或无法读取 : minima

html - Internet Explorer 和 Windows Phone 无法识别特定主机上的 UTF-8

javascript - 从文本区域内的文本中删除空格

css悬停信息显示

javascript - 创建一个 DIV onclick

jquery - highmap 数据点点击事件在移动设备(触摸屏)上缩放后中断

jquery - $(document).ready(function() 不工作

html - CSS:如何将宽度设置为 child 的宽度?

html - 使用 Kramdown/Jekyll 定义脚注位置