Home > Web Front-end > CSS Tutorial > A brief discussion on the overlap of margins in css

A brief discussion on the overlap of margins in css

高洛峰
Release: 2017-03-07 14:01:12
Original
1536 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template