Why Margin-top is not acting on the parent element:
Recommendation : As far as possible handwriting code, can effectively improve the learning efficiency and depth.
As for the basic usage of the Margin-top attribute, it is simply to set the top margin of an object and see the following code example:
<! DOCTYPE html>
The above code can set the top margin of p to 50px, everything works well, without any problems, and then look at the next piece of code:
<! DOCTYPE html>
1. There is no border between the top margin of the parent element and the top margin of the child element.
2. 3. 3. The positioning properties (except static and relative), overflow (except for the visible) and display are not set in the parent and child elements: Inline-block and so on.
4. Either the parent element or the resource is not floating.
Note: The above conditions must be met before you can. The way to solve this situation is also simple, as long as it destroys one of the above situations.
More about the margin merge content can be found in the