【发布时间】:2018-01-15 09:36:03
【问题描述】:
我正在尝试完成类似 instagram 帖子的示例:https://www.instagram.com/p/BXgsKFLBczA/?taken-by=claymicro 列表扩展但不向下推页脚
在我的示例中,如果我将 margin-bottom 添加到评论类中,它会推动<div class="post-details-container"> 的高度,并且会有间隙。
我想要的是增加 cmets 之间的 margin-bottom 但这应该会增加 <div class="body> 容器的溢出,而不是扩展其他 div 并在图像容器中留下绿色间隙。
Jsfiddle 示例:https://jsfiddle.net/ou21qe09/2/
如果我向评论类添加超过 5 像素,它会扩展并在图像容器中留下绿色间隙。还将 padding-top 添加到 <div class="header"> 也会推动 div 高度并留下绿色间隙,请注意,我无法以主体或评论容器的像素为单位设置 max-height,因为图像大小会有所不同,这决定了 <div class="post-details-container" 高度。
.comment {
margin-bottom:10px;
}
我该怎么办?在 <div class="post-details-container"> 上设置 max-height 或其他一些解决方法?
非常感谢!如果需要更多解释,请告诉我:)。
【问题讨论】:
-
我不明白。
-
好吧,我链接到了 instagram 帖子,该帖子显示了我要完成的工作,添加新 cmets 不会推动细节 div 的高度,并且 cmets 容器溢出只会增加,在我的示例中增加 cmets 会导致高度帖子详细信息 div 增加,并在图像容器中留下间隙