Home > Article > Web Front-end > A brief discussion on the overlap of margins in css
Parent and child element margin overlap
Solution:
Give Add floating attributes to child elements, and add necessary clear floating attributes to corresponding parent elements;
Add edge attributes to parent elements, such as padding and border;
Margin of sibling elements Reverse overlap
When the margins of sibling elements overlap in reverse, the distance between elements is the larger of the two margin values.
Because there are few solutions and poor compatibility, this situation should be avoided as much as possible in specific coding.
The above brief discussion on css margin overlap is all the content shared by the editor. I hope it can give you a reference, and I also hope that everyone will support the PHP Chinese website.
For more articles related to the overlapping of margins in css, please pay attention to the PHP Chinese website!