使具有上边距的 div 忽略其上方的 div
我有两个 div,一个在另一个上面,我希望底部的 div 忽略上面的那个。底部 div 具有顶部边距属性。忽略我的意思是我不希望顶部 div 在使用顶部边距时被计算在内(而是推动包含两个 div 的包装器。)
I have two divs, one above the other, i would like the bottom div to ignore the one above it. The bottom div has the top margin property. By ignore i mean i dont want the top div to be counted when it is using top margin (but rather to push against the wrapper which contains both divs.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需对顶部 div 使用绝对定位即可。
Just use absolute positioning for the top div.
如果我理解正确的话,你可以将顶部 div 更改为position:absolute;这将从文档流中取出。
If I understand correctly you could change the top div to position:absolute; which will take if out of the flow of the document.