开发者

Why does putting a margin on one div move its container?

开发者 https://www.devze.com 2023-03-16 17:53 出处:网络
I\'ve a container div which has another div inside it. When I apply a margin to the inner div it appears to a margin-top to the container div (although it开发者_Go百科 doesn\'t give a left margin)

I've a container div which has another div inside it. When I apply a margin to the inner div it appears to a margin-top to the container div (although it开发者_Go百科 doesn't give a left margin)

http://belfastswimmingteacher.com/mockup.html

What's the craic?


You can either float the halfLeft div, or add padding-top to #content.

This is known as margin collapsing, and whilst may produce this unwanted behaviour, is in fact intended and correct.

0

精彩评论

暂无评论...
验证码 换一张
取 消