【发布时间】:2013-12-30 07:03:47
【问题描述】:
我有一个框,每个框都显示博客文章的标题和日期。博客标题最多将占据方框的三行。
HTML
<article class="box" style="height: 144px">
<header class="entry-header" style="padding-top: 15%;">
<?php the_title(); ?>
</header>
<footer class="entry-meta" style="font-size: 12px;">
<?php echo get_the_date(); ?>
</footer>
</article>
CSS
.box {
background-color: #333333;
color: white;
}
.box header {
text-align: center;
word-wrap: break-word;
margin: 0 10px 0 10px;
}
.box footer {
text-align: center;
}
由于标题的长度可能不同,我无法将日期与框的底部对齐。
预期结果
我尝试将margin-top 设置为footer,但这并不能正确对齐日期,因为它们都显示在不同的行上。有没有其他方法可以解决这个问题?
【问题讨论】:
-
Constant row hight 的可能重复项