我的问题是无法识别内容的高度,这会导致正文小于内容,从而导致更多问题。
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/