1. What is the margin?
margin is used to control the elements around the space interval, from the vision to achieve the purpose of space interval. Compared with the previous elements have corresponding from outside. Used to separate elements with elements. Will always be transparent.

2. Outside from the merger of the problem (see w3school) - the premise: elements from the document flow
2.1 when they met two vertical distance outside, outside will occur in the vertical direction from the stack, the final margin is equal to the larger value of both;
2.2 when an element (without the borders and padding) contains another element, the superposition of will occur in the vertical direction;
2.3 when an element is empty elements (and not from outside and), itself will occur outside of overlay

3. Margin on block and inline elements element
the difference between margin in block elements affect block elements of up and down the left and right sides, can control at will; While in the inline element will only to elements of the horizontal direction.
note: replacement of inline elements, such as img, input, textarea, the select button, label, etc., and can control its width, height and liquid for the display: inline - block. So the margin also can realize the up and down or so control.

4. Common bug related to margin
4.1 IE6 bilateral problems
problem description: when the parent element contains the first element for the floating element, there will be a bilateral is apart from the problem;
solution: display: inline
4.2 iIE6 floating element
3 px interval problem description: a floating element, another for the floating element, the floating element and floating element, the interval of between 3 px

5. The difference between the padding and margin
padding located in internal borders, background colors, separated is mainly used for content and elements; And margin is located in the border of the external, do not have the background color, is mainly used to distinguish between elements and elements, have the effect of isolation.

6. Margin of negative margin problem (to be continued)
use margin of negative margins can solve many problems.

information

http://www.planabc.net/2007/03/18/css_attribute_margin/http://www.hicss.net/do-not-tell-me-you-understand-margin/


This concludes the body part