Margins & Images Issue

独自空忆成欢 提交于 2019-12-12 19:13:35

问题


for the life of me, i can't figure out why the margins won't render properly on some of the images here. After the first and second landscape orientation images, the margins overlap with the image/container above it.

Can anyone shed some light?

http://jsfiddle.net/JeffPannone/rDw6R/17/

*sorry everyone. I provided the wrong jsfiddle link previously. i corrected it here


回答1:


One option is to set overflow:auto to the div.

jsFiddle example




回答2:


The margin of you images can collapse out of the div because you div has no border or padding.

I was adding some W3C documentation, but it's a bit much to give you a clear description of margin collapse in a few lines. Just follow the link above for detailed information.

A simple fix would be adding a padding of 1px 0 to the div.

http://jsfiddle.net/rDw6R/1/



来源:https://stackoverflow.com/questions/12412924/margins-images-issue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!