我有一个元素,高度,填充和溢出:隐藏。它的子元素尊重顶部和侧面的填充,但是它与父母的填充底部重叠。我如何防止这种情况?CSS:获取子元素,以尊重父母的填充底部
#parent{
background:yellow;
overflow:hidden;
width:100px;
height:100px;
padding:25px;
}
<div id = "parent">
<div id = "child">
text text text text text text ...
</div>
</div>
编辑:响应的建议,这是一样的overflow:hidden ignoring bottom padding,事实并非如此。我的问题的最终答案比任何其他问题的答案都要优雅得多,因为我的设置不同:我只有一个子元素。
[溢出:隐藏忽略底部填充]的可能的复制(http://stackoverflow.com/questions/8981811/overflowhidden-ignoring-bottom-padding)母体的 – Steven
删除高度。 – Tushar