One. Horizontal center

1. Set the margin property to:

2. The distance from the top 100px, left and right automatic, distance from the bottom 100px

margin: 100px auto 100px;
Copy the code

Ii. Margin:

1. The CSS style of the body in HTML has an 8px margin

2. Set the HTML body margin to 0:

body{
    margin:0;
}
Copy the code

3. Set the margin of the content to be pasted to 0 again to be pasted

Iii. Set margin attribute to negative to achieve de-overlap:

1. This code looks like this

2. When the border of the six boxes is set to 1, the upper border overlaps with the lower border

Set the element margin-top to **-1** :

4. Look at the effect again, the border changed from 2 to 1, because the margin-top attribute of **-1px moved it up 1px, while the margin-bottom** remained unchanged.

The realization of edge – removing coincidence.