在html到PDF中将框内容与底部对齐-无flexbox 我有一个盒子,它有一个静态的高度,包含3个其他的盒子,第一个和最后一个是静态的高度,中间的那个是动态的。 div { box-sizing: border-box; overflow: hidden; word-break: keep-all; white-space: nowrap; } .returnsPolicy { height: 33mm; margin: 0; border: 0; font-size: smaller; text-align: center; padding-bottom: 1mm; /*position: relative;*/ } p { margin: 0; border: 0; white-space: normal; vertical-align: bottom; } .returnsHeaderRow { height: 4mm; line-height: 4mm; font-weight: bold; /*margin-top: auto; margin-bottom: 0;*/ } .returnsDisclaimerRow { height: 4mm; line-height: 4mm; /*position: absolute; bottom: 0;*/ } .returnsMainContent { max-height: 20mm; height: auto; /*position: absolute; bottom: 4mm;*/ } <div class="returnsPolicy"> <p class="returnsHeaderRow"> <b> We want every customer to be totally satisfied with their purchase. </b> </p> <p class="returnsMainContent"> If you change your mind about your purchase, please return the unused goods to us with the original proof of purchase within 45 days, and we will offer you an *exchange or a refund. This does not affect your statutory rights, including your right to claim a refund, repair or exchange where the goods are faulty or misdescribed. </p> <p class="returnsDisclaimerRow"> *Excluding all shoe care products </p> </div>

在html到PDF中将框内容与底部对齐-无flexbox 我有一个盒子,它有一个静态的高度,包含3个其他的盒子,第一个和最后一个是静态的高度,中间的那个是动态的。 div { box-sizing: border-box; overflow: hidden; word-break: keep-all; white-space: nowrap; } .returnsPolicy { height: 33mm; margin: 0; border: 0; font-size: smaller; text-align: center; padding-bottom: 1mm; /*position: relative;*/ } p { margin: 0; border: 0; white-space: normal; vertical-align: bottom; } .returnsHeaderRow { height: 4mm; line-height: 4mm; font-weight: bold; /*margin-top: auto; margin-bottom: 0;*/ } .returnsDisclaimerRow { height: 4mm; line-height: 4mm; /*position: absolute; bottom: 0;*/ } .returnsMainContent { max-height: 20mm; height: auto; /*position: absolute; bottom: 4mm;*/ } <div class="returnsPolicy"> <p class="returnsHeaderRow"> <b> We want every customer to be totally satisfied with their purchase. </b> </p> <p class="returnsMainContent"> If you change your mind about your purchase, please return the unused goods to us with the original proof of purchase within 45 days, and we will offer you an *exchange or a refund. This does not affect your statutory rights, including your right to claim a refund, repair or exchange where the goods are faulty or misdescribed. </p> <p class="returnsDisclaimerRow"> *Excluding all shoe care products </p> </div>,html,css,node.js,phantomjs,Html,Css,Node.js,Phantomjs,但不幸的是,这不是我的情况 returnsMainContent是一个包含动态内容的框,我的目标是将所有内容与底部对齐。这是一个页脚,我希望它占用尽可能少的空间,但是如果我的文本没有填充returnsMainContent中的区域,那么ReturnsDisclamerRow之后我将有一些空白 通过使用相对/绝对定位,我可以将returnsDisclaimerRow和returnsMainContent放置为底部对齐,但是returnsHeaderRow不能使用绝对值进行定位,结果是它和retur

但不幸的是,这不是我的情况

returnsMainContent是一个包含动态内容的框,我的目标是将所有内容与底部对齐。这是一个页脚,我希望它占用尽可能少的空间,但是如果我的文本没有填充returnsMainContent中的区域,那么ReturnsDisclamerRow之后我将有一些空白

通过使用相对/绝对定位,我可以将returnsDisclaimerRow和returnsMainContent放置为底部对齐,但是returnsHeaderRow不能使用绝对值进行定位,结果是它和returnsMainContent之间出现空白

一个解决方案是添加一个只包含空白的附加动态段落,这将扩展并将其他段落推到底部,但当我尝试时,我最终覆盖了其他段落


想法?

您可以做的只是为您的内容添加一个包装器div,这就是您用
位置:绝对值设置的包装器div;底部:0。然后,内部的所有内容都可以在流中占有一席之地

您只需注意包装器div中的内容在高度上不会超过
。returnsPolicy
,因为它不会适应大小,但这似乎不是您的情况

div{
框大小:边框框;
溢出:隐藏;
断字:保留一切;
空白:nowrap;
}
返回政策{
高度:33毫米;
保证金:0;
边界:0;
字体大小:较小;
文本对齐:居中;
垫底:1mm;
位置:相对位置;
}
.returnsPolicyWrap{
位置:绝对位置;
底部:0;
}
p{
保证金:0;
边界:0;
空白:正常;
垂直对齐:底部对齐;
}
谢德罗先生{
高度:4mm;
线高:4mm;
字体大小:粗体;
}
.返回Disclaimerrow{
高度:4mm;
线高:4mm;
}
.返回内容{
最大高度:20毫米;
高度:自动;
}

我们希望每位客户都对他们的购买感到完全满意。

如果您改变了购买想法,请将未使用的商品连同原始购买证明退还给我们 在45天内购买,我们将为您提供*兑换或退款。这不影响您的法定权利 权利,包括您在货物出现故障或描述错误时要求退款、修理或更换的权利。

*不包括所有鞋护理产品


必须这么简单:P谢谢
display: flex;
flex-direction: column;
justify-content: flex-end;