Skip to content Skip to sidebar Skip to footer

Inner Div Not Respecting Margin-top Relative To Parent Div

Check this extremely simple html structure. One div inside another, the inner (green) div has margin-top: 100px, the outer (red) div has no margin-top. The outer div is twice (200p

Solution 1:

Its normal way of rendering and it is called margin collapsing. More you can read here

Solution 2:

I think its a parent/child dependency issue. The position of both Divs are default : 'static'. So the red Div is behind the green Div which has the margin-top.

Post a Comment for "Inner Div Not Respecting Margin-top Relative To Parent Div"